HTML Form Tutorial, Part I
By Will Bontrager2004-07-06
How Information Is Sent
Another <form> tag attribute specifies how the information will be sent to wherever it's going. That's the "method" attribute. The method attribute is either
method="POST"
or
method="GET"
Which you use depends on how the destination program or function wants to receive the information.
Sending With Method GET
method="GET" is used if you want to send information somewhere via a browser URL. You've seen URLs that send information; they look something like:
http://domain.com/something.cgi?color=red&shape=round
In the above URL, the part after the question mark is information sent to something.cgi. Multiple information chunks are separated with an ampersand.
The GET method can send only a limited amount of information. The limitation depends on the server where the current web page is on and the server where the information is sent to. The limitation can be as little as 256 bytes but is often 1k or more.
Another limitation of the GET method is that the information being sent is visible in the browser's address bar. In some cases this is of no consequence. In others, it is unacceptable.
Some CGI programs are written to accept information via the GET or the POST method, some to accept only the GET method.
Sending With Method POST
method="POST" is the most common method used to send information from a form to an information processing program or function. This is the method used when sending form information to JavaScript functions. Most CGI programs are written to accept information with the POST method, some to accept only the POST method.
The POST method can send much more information than the typical GET method. Currently, most browsers and servers limit the amount of POST information to about 32k.
With POST, the information is not sent via the URL. The sending is invisible to the site visitor.
It is not necessary to know the exact interior mechanism of how POST works, because all you have to do is specify the method and the browser decides how to accomplish your directive. However, as a general overview: depending on its destination, the POST information could be transferred within the browser itself (if sent to a JavaScript function) or over the internet via a method known as "standard input" -- the default or standard input channel expected by the destination (such as a server for a CGI program).
Tutorial Pages:
» HTML Form Tutorial, Part I
» How Information Is Sent
» Specifying the Encoding Method for the Information Being Sent
» Form Related Tags
» The <input> Tag
» Part II
Copyright 2004 Bontrager Connection, LLC
