Websites often need to collect some data from visitors using which they can be given specific information back or the data be processed for the further action. Common examples are application form, feedback form, registration form for an event, subscription forms, contact forms, order placement form or options to filter data for specific needs of users. This is a kind of dynamic interaction of a visitor with a website where users, rather than reading the presented information, also provide data. HTML Form comes handy in all such web applications.

form is a container element in HTML which allows adding other HTML form elements like text, buttons, combo, list, radio button, checkboxes etc. These controls can be added by using <INPUT> tag and setting TYPE attribute in it. When a form is submitted, the data entered or selected by a user in a form can be sent to web server using GET or POST methods.

Features of HTML Form

  • It is a container element where other form elements can be added to make an input form.
  • HTML form is not a visible element in itself.
  • A form is created using <FORM></FORM> paired tag.
  • Form can be added anywhere in the body section of a webpage. Other standard HTML markup elements like paragraph, headings, tables etc. can also be used in a form.  These elements can be added as components of a form to explain the meaning of different fields and use of a web form. For example Text can be used to define form elements’ labels. Paragraph can be used to give a descriptive note. Headings can be used to give common heading for a group of form elements.
  • One webpage may contain multiple forms.
  • Nesting of forms is NOT allowed.

Syntax of Form Tag

A web form can be created in a web page by placing < FORM ></ FORM > in a web page and adding all the Form elements within the form tags.

Place all the HTML form elements here

Attributes of HTML Form Tag


Action attribute specifies the destination web page that receives the data submitted by a user in a web page. It is the name of a script file like an ASP or PHP that will accept the data and process it or save in the database server or an email address.


Method attribute specifies how the destination web page will receive the data from a web form. The two possible values are GET and POST. Read here for understanding the functioning of these two methods.

Example for an HTML Form

    <FORM  action="addcontact.php" method="post">
    Your Name
    <input type="text"  Name="name">
    Email ID
    <input type="text"  Name="email">
	<Textarea rows="5" cols="25"></Textarea>
HTML form example