Java Reference
In-Depth Information
The checkbox control works the same way, except that any number of check boxes
can be selected.
<input type="checkbox" name="checkbox" value="Check Box">Check
Box<br>
A choice control works just like a radio button, except it takes less space on the page.
The user selects from a drop-list of values.
<select name="choice">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
The drop-list returns data as a name-value pair, just like any other control. For example, if
you choose “Option 2” from the above list, the following name-value pair would be returned:
choice=2
As you can see, to a bot, all controls are handled the same. The controls may look differ-
ent to the user, but for a bot, they are all just name-value pairs.
POST or GET
In the previous section we mentioned two different ways of responding to a form: the
HTTP POST and HTTP GET . Both of these two methods are commonly used by web serv-
ers and will be utilized by your programs. As an HTTP programmer you will not pick whether
to use POST or GET ; rather, you must use whichever protocol your target web server is
using. The next two sections will discuss HTTP POST and HTTP GET .
Using HTTP GET
HTTP GET is the easiest way to respond to a form. It works very similar to HTTP POST ,
in that a series of name-value pairs is transmitted; however, you are limited by the amount of
data you can transmit. Most browsers allow the URL like to be only so long. The length varies
with the browser; however, most browsers maximum URL length is around 2,000 characters.
Also, because all form data is visible on the browser's URL line, it is very easy for the user to
tamper with the data sent.
There is no way to tell if a form is GET or POST just by examining it on the screen. To
make this determination, you must examine the HTML source code. A form that makes use
of HTTP GET , will have a <form> tag similar to the following:
<form action="somepage.php" method="GET">
Search WWH ::




Custom Search