HTML Forms

An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes and radio buttons, select, etc.), and labels on those controls.

The HTML <form> tag is used for declaring a form. This tag comes in pairs. The special elements which are called controls are written between opening (<form>) and closing (</form>) tags .

Following form elements are used:

With the <form> tag action, method and name

The action attribute specifies a URI/URL of the page that will process the form.

The method attribute specifies the HTTP method to use when the form is submitted. Possible values are:

  • get (the form data is appended to the URL when submitted)
  • post (the form data is not appended to the URL)

The name attribute assigns a name to the form.


<!DOCTYPE html>
    <title>Title of the document</title>
    <form action="server-script-url-here" method="GET or POST" >
      <label for="fname">First name:</label>
      <input type="text" name="FirstName" id="fname" value="Angelina"/><br/><br/>
      <label for="lname">Last name:</label> 
      <input type="text" name="LastName"id="lname" value="Jolie"/><br/><br/>
      <input type="submit" value="Submit"/>