The purpose of the form
Forms provide an interface for collecting, displaying, and delivering information. Forms providing different controls such as text fields, buttons, and checkboxes, forms can enhance Web pages with a means to exchange information between a client and a server. The various controls allow authors and users to perform actions, make choices, and quickly identify and enter information. When the form data is submitted to the server- or client-side script, the information either is parsed and catalogued, or redirected in response to the submission.
The typical contents between <form> and </form> are
- The
<form>element (the container for everything that is to follow) <input>– which includes many types, including text, submit, button, radio button and checkbox
| contents | Purpose | |
| 1 | input type=”text” | Single-line text field |
| 2 | input type=”password” | Text field masked with asterisks |
| 3 | input type=”button” | input element as a button |
| 4 | input type=”submit” | Button that sends all the information for a particular form to the script or program specified in the action attribute |
| 5 | input type=”radio” | selecting one item from a set |
| 6 | input type=”checkbox” | selecting multiple groups of topics |
| 7 | select | Drop down list |
| 8 | Textarea | Entering multi-line text |
| 9 | input type=”reset” | Button that resets all form values |
| 10 | input type=hidden | Hidden control |
| 11 | input type=file | Nonscriptable text field and Browse button |
| 12 | input type=image | Submit control as an image |
The significance of the form attribute is
Action
The value of the action is URL .When the user clicks on the “Submit” button, the content of the form is sent to another file. The form’s action attribute defines the name of the file to send the content to. The file defined in the action attribute usually does something with the received input.
methods
The methods has two value get and post the default value get The HTTP method for sending data to the action URL
method=”get”: This method sends the form contents in the URL:
method=”post”: This method sends the form contents in the body of the request.
Enctype
The value is mime type
The mimetype is used to encode the value of the form.