In HTML, the form tag is used to designate an area of a web page that can be interacted with by a user in order to submit information. A form tag is defined using a specific format. Inside the form tag, a variety of different inputs can be used such as simple text fields and checkboxes. When a form is submitted, the information is passed to a server that can either act on the information immediately or store it in a database. There are two methods used to submit an HTML form called “get” and “post.”
In between the two form tags, the individual elements are placed including a submit button. Usually a form tag is defined with the attributes “action” and “method.” The action is the script that is used to process the information and the method is how the data is transferred to that script. In many cases, the script will be used to enter the information from the form into a database for further reference.
Some common input types that can be used inside the form tag include text fields, radio buttons and drop down boxes. A password field can also be used that hides data entered by the user. All forms have to finish with a submit button that is used to send the information to the server. Each field of a form has to have a unique name so that fields of the same input type can be distinguished from one another.
When users enter data into a form and click submit the action script decides what happens next. For a simple search box, the data may be used immediately without the need to enter it into a database. A sign up form will use an action script to format the data provided by the user and then record it.
There are two methods used to submit form information. “Get” is used to send data in the URL by appending a question mark followed by the information. “Post” data is sent in the form body to the processing script.