Lesson 5.1. HTML forms


Forms are fundamental xhen creating dynamic web pages since they allow the user to interact with the site and to send data. Here is an example of a form with buttons, fields and drop-down lists:

HTML forms example


Tag <form> </form> defines the begining and endding of an HTML form. This tag accepts two main attributes:

Here is an example of HTML form:

<form action="processin.php" method="post">
  Enter your name :
  <input type="text" name="name">
  <input type="submit" value="Send">

here is a simple PHP script that displays the received data:



Modify the previous script to add a new input field as on the following illustration:

Exercice on HTML forms, firstname and lastname HTML form

See also

Last update : 09/17/2022