Category: 

In HTML, what is a Form Tag?

Article Details
  • Written By: Alex Paul
  • Edited By: Jacob Harkins
  • Last Modified Date: 19 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Due to synthetic materials and furnishings, new homes burn about five times faster than those built 30 years ago.  more...

September 25 ,  1789 :  The US Bill of Rights was adopted.  more...

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.

Ad

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.

There are many examples of the form tag on the internet. For example, any website that requires a login uses a simple form in order to check the user’s details against those in a database. In this case a password field will be used to keep the user’s password private. Online order forms, sign-up pages and surveys also use forms. Although HTML tags are used for any website form the layout or functionality may be enhanced by other languages including JavaScript.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email