HTML forms are used to send information to server. You can use input elements like text fields, radio buttons, check box, dropdown etc. to capture information. You can use multiple forms in a single HTML page, but you can't use one form inside another form.

<form action="contact.php"></form>

Form and the Attribute:

Action: This attribute is used to send the information to the specified page. In the following page the value of all input filels will send to contact.php page.

<form action="contact.php"></form>

Autocomplete: As you start type in a input fields your browser history shows the previously entered value, to avoid that you can set autocomplete off.

<form action="contact.php" autocomplete="off"></form>

Method: Method is use to set the send method of the form. It can either be GET or POST. To know more please click here.

<form action="contact.php" method="post"></form>

Name: Name attribute is used to assign a name to the form. It may required in JavaScript.
<form action="contact.php" method="post" name="myForm"></form>

HTML Forms Input Element

The Input elements are used to capture the user information.
<form action="contact.php" method="post" name="myForm">
<input type="text" />
</form>

Input and the Attribute:

Type: This attribute is use to define what type of element you want to display. It can be button, checkbox, file, hidden, image, password, radio, reset, submit or text.
<form action="contact.php" method="post" name="myForm">
<input type="text" />
</form>

Name: This is used to assign a name to the input fiel. Plese use unique name to each element in a form.
<form action="contact.php" method="post" name="myForm">
<input type="text" />
</form>

Value: This attribute is use to set the default value of an element.
<form action="contact.php" method="post" name="myForm">
<input type="text" value="Enter Name" />
</form>

You can also set the height, width of an text input field. And also assign calss and id to any input field.

In the Next Chapter We will Discuss About HTML5 Form Element

Top