We already know that the action attribute of the form is
going to send the user information to a script, which will then read it.
There are two ways to accomplish this through
"get" or "post."
First, let's talk about get. Probably the easiest way to explain get is
to show it in action. I'd like you to enter some information in the form
below and then click on the Submit button.
After the next page loads, take a look at the URL in your browser. You
should notice that, after the page name
(/authoring/html_basics/stuff4a/ot_nextpage2.html), there is a
question mark. Following that, we have the name of the textbox
("thebox"), an equals sign, and the text you entered. This portion of the URL
is called the querystring.
So by using get, values of the form elements are carried to the
querystring in "name=value" pairs. Spaces are substituted with %20,
and additional form elements are separated by ampersands. Once you
pass the information to the querystring, a CGI script, JavaScript, or ASP
script can make use of that information.
Get is commonly used because it offers one very nice feature: When
users bookmark pages, they bookmark the querystrings with it. Sites like
Amazon will use the querystring for just this reason; that way you can
bookmark the page, return, and buy the book. But this also raises a
potential problem. In some cases, you may not want the user to see the
values passed along by the form. In these circumstances, you'll use the
"post" method. With post, the form information can still be read by whatever
script you're using, but it is not visible to the user and cannot be
bookmarked.
OK, now that you know your methods, let's finish up by taking a
closer look at the different kinds of form elements.
next page»