Web4College

HTML form tag

HTML <form> tag defines a form that collects the data from the user. There are many other elements (input controls such as checkbox, radio buttons, button etc.) that form the structure of form. The values of those elements are sent to the server for processing.

Example
Try it
<p>form attribute in the input element associates it with the form</p>
 <form action="files/formtag.php" method="post">
  Candidate name: <input type="text" name="cname"><br>
  Email: <input type="email" name="cemail"><br>
  Password: <input type="password" name="pass" ><br>
  <input type="submit" name="submit"></p>
 </form>

form attribute in the input element associates it with the form

Candidate name:
Email:
Password:

Tag omission

Both starting and ending tags are necessary for the form element.

Global Attributes

All the global attributes are applicable on the form element.

Tag Attributes

Attributes that are applicable to <form> tag
accept-charset

It represents the character encoding type of the form.

Example
Try it
<form action="process.php" accept-charset="UTF-8"> form structure consisting of input elements</form>
action

It represents the HTTP method to submit the data.

Example
Try it
<form action="process.php"> form structure consisting of input elements</form>
autocomplete

Input field suggests the user different options for autofill feature.

Example
Try it
<form action="process.php" autocomplete> <input type="text" name="fname" /> </form>
enctype

encoding type for the form submission.

Example
Try it
<form action="process.php" enctype="text/plain"> form structure with input element.</form>
method

This attribute gives the controls such as play/pause, volume control.

Example
Try it
<form action="process.php" method="post"> form structure consisting of input elements</form>
name

specifies a unique name for the form.

Example
Try it
<form action="the file name to process the form" name="candidate-data"></form>
novalidate

The form is submitted without validation.

target

represents the browsing mode of form submission.

Example
Try it
<form action="" target="_blank"> The data in input controls. </form>