HTML Forms attributes are used to activate responses from users through a graphical user interface consisting of the fill-in blanks, Buttons, Check boxes etc. A Form consists of HTML (Hypertext Markup Language) elements. An HTML (Hypertext Markup Language) Form is part of a Web page which you creating using HTML (Hypertext Markup Language) elements.
HTML Forms attributes<FORM Tag>
A FORM Tag is Used in an HTML (Hypertext Markup Language) document just like any other element. It has a start tag, <FORM> and an end tag </FORM>. The form itself contains regular text, other HTML (Hypertext Markup Language) elements such as tables and form elements such as check boxes, pull-down menus and text fields.
HTML Forms attributes can not be nested i.e. you cannot put one into another. Forms can include other elements, such as list or <PRE>. HTML Forms attributes are mentioned in the following paragraphs.
<FORM ACTION = “HTTP://WWW.GOOGLE.COM\HTML\
FORMS.HTML”METHOD = POST”>
Different HTML Forms attributes of the forms are as follows,
a. Action attribute
b. Method attribute
c. Enc type attribute.
1. Action attribute
It specifies the Uniform Resource Locator (URL), (URL is simply an address of a document on the internet. It has four parts. These parts are:-
2. Host Name
3. Folder Name
4. File Name.
Each of these has a specific function to play. Depending on the application, a URL can include additional information, to specify users names or input to a server side script.)
URL of the program or script that accepts the contents of the form for processing. If this attribute is absent, the base URL (URL where the form is located on the server) of the form is automatically used.
2. Method attribute
Method Attribute specifies which method type will be used to submit the form data. Which method we use depends on how our particular server works. The possible values are:
These are the HTTP(Hypertext Transfer Protocol) methods that a browser uses to talk to a server.
This is the default method for browsers to submit information. HTML Forms attributes, HTML pages are generally retrieved by requesting a single URL from a Web server using the GET method.
For example, when we write,
The above URL is translated into a valid HTTP GET request like the following,
The GET method is not very secure, since that data input appears in the URL. Furthermore, It is impossible to append a large amount of data with the GET method. Another problem is that it is not suitable for foreign languages other than English.
With the above written problems, we use GET as a default because it is easy to deal with. GET method is used well in search engines. When a user submits a query to a search engine, then engine runs the query and then returns page up to page of results.
In situation in which a large amount of information must be passed, HTML Forms attributes, the POST method is more appropriate than GET method. This transmits all from input information immediately after the requested URL. Or we can say, once the server has received a request from a form using POST, it knows to continue listening for the rest of the information.
In some sense, this method requires making two contacts to the Web server. The encoding of the form data is handled in the same general way as the GET method. Spaces become plus sign, and other characters are encoded in the URL fashion.
3. Enc type Attribute
HTML Forms attributes Enc type only applies if METHOD is set to POST. It identifies the media type. This media type is used for encoding the name/value pairs of the form’s data.