Java Reference
In-Depth Information
As you recall from the last section, the data from an HTTP form is nothing more than a
series of name-value pairs. Consider a form that has two text fields, one named first and
the other named last . If the user entered “Jeff” for the first field and “Heaton” for the sec-
ond field, the two name-value pairs would be:
first=Jeff
last=Heaton
However, when two fields are transmitted, using either GET or POST , the name-value
pairs are concatenated together and separated by an ampersand (&). The two fields above
would be encoded as:
first=Jeff&last=Heaton
In the case of an HTTP GET , the name-value pairs are simply concatenated onto the
URL. The <form> tag above is set to send its data to a page named somepage.php .
Thus, to send the fields first and last to test.php , the following URL would be used:
http://www.httprecipes.com/1/test.php?first=Jeff&last=Heaton
As you can see, the parameters are concatenated directly onto the end of the URL. A
question mark (?) separates the parameters from the rest of the URL.
To see this in action, visit the following URL:
http://www.httprecipes.com/1/7/get.php
When you enter a state and click “Search” you will see Figure 7.2.
Search WWH ::




Custom Search