Lesson 5.3. Input fields

The <input> tag

The <input> tag is the most important field in the forms. The main attribute is type =" ", the latter will determine how the field will be displayed:

The name attribute

The name attribute specifies the name of the field which must be unique. It is this name that will serve as an identifier for the processing script. For example, data from field

<input type="text" name="city">

will be posted in the PHP variables $_POST['city'] ou $_GET['city'].

The value attribute

The value="" specify the default value that will be displayed in the field when the page will be loaded :

<input type="text" name="city" value="Paris">


The placeholder attribute

The placeholder="" attribute displays a message or an example for the user that will be automaticaly deleted as soon as the user enter the first character in the field:

<input type="text" name="city" placeholder="Enter your city">



Write the HTML code to display an identification form (email and password) according to the following example:

Exercic, create a connection form

In the file process.php, check that received data are pierre@gmail.com for the email and abcdef for the password:

See also

Last update : 09/17/2022