The method Attribute
The method attribute specifies one of two methods, either get or post, for submitting the form information to the server. Form information is typically transferred in a series of variables with their respective content, separated by the ampersand (&), as shown here:
variable1=content1&variable2=content2&variable3=content3
The name attributes of form control elements provide the variable names. The content the user enters makes up the content assigned to the variable.
Using the form in Figure 15-1 as an example, if a user entered “Josephine” next to “First Name” and “Josie” next to “Nickname,” the form passes the variables on in this format:
name=Josephine&nickname=Josie
With the get method, the browser transfers the data from the form as part of the URL itself (appended to the end and separated by a question mark) in a single transmission. The information gathered from the nickname example would be transferred via the get method as follows:
get http://www.domainname.com/cgi-bin/guestbook.pl?name=
Josephine&nickname=JosieThe post method transmits the form input information separated from the URL, in essentially a two-part message. The first part of the message is simply the special header sent by the browser with each request. This header contains the URL from the form element, combined with a statement that this is a post request, plus some other headers we won’t discuss here. This is followed by the actual form data. When the server sees the word "post" at the ...