An HTML form is a section of a document which contains different fields like text
HTML Forms can be used where we want to collect some data from the site visitor. For example, in case of user registration you would like to collect information such as name, email address, Phone number, etc.
A form will take input and then store it to a back-end application such as CGI, ASP Script or PHP script etc. The back-end application will perform required processing on the passed data like storing it in database.
There are various form elements available like
<form> tag defines a form that is used to collect user input.
All the form elements should be written inside
||It defines an HTML form to enter inputs by the used side.|
||It defines an input control.|
||It defines a multi-line input control.|
||It defines an option in a drop-down list.|
||It defines a drop-down list.|
||It defines a label for an input element.|
||It groups the related element in a form.|
||It defines a caption for a
||It defines a group of related options in a drop-down list.|
||It defines a label for a field.|
The most important form element is the
<input> element can be displayed in several ways, depending on the type attribute.
<select> element defines a drop-down list. It mostly used when you have to show numbers of items.
<option>element defines different options that can be selected.
<option value="abc" selected>.
<textarea> element defines a multi-line input field.
<button> element defines a clickable button.
method attribute specifies the HTTP method (GET or POST) to be used when submitting the form data.
GET is the default method when you submitting your form data.
|Points||GET METHOD||POST METHOD|
|Data Pass||Limited amount of data can be sent because data is sent in header.||Large amount of data can be sent because data is sent in body.|
|Security||Get request is not secured because data is data sent is part of the URL, and this data saved in browser history and server logs in plaintext.||Post request is secured because data is not exposed in URL bar and parameters are not stored in browser history or in web server logs.|
|Bookmarked||Request can be bookmarked and cached.||Request can not be bookmarked and cached.|
|Usability||GET method should not be suitable when you are sending sensitive data like user id or Passwords.||POST is good for when you are sending sensitive data because your data are sended in encrypted form.|
|Data Length||Data length restricted, usually to 2048 characters.||No restrictions on the amount of data that can be sent.|
|Hacked||Easier to hack.||More difficult to hack.|
name attribute specifies the name of
It is a good practice to use this attribute, and also good for SEO purpose.
<fieldset> element is used to group related data in a form and the
element defines a caption for the