HTML and CSS Reference
Watching GET in action
There's no better way to understand GET than to see it in action.
Open up your “form.html” file and make the following small change:
<form action="http://starbuzzcoffee.com/processorder.php" method=" GET ">
Save and reload the page; then fill out the form and submit it. You
should see something like this:
Now y ou can se e every fo rm
elemen t name a nd its val ues
right here in t he URL.
Q: Why is it called GET if we're
sending something to the server?
A: Good question. What's the main job of
a browser? To get web pages from a server.
And when you are using GET, the browser
is just going about getting a web page in the
normal way it always does, except that, in
the case of a form, it has appended some
more data to the end of the URL. Other than
that, the browser just acts like it's a normal
Q: So why would I use POST over GET,
or vice versa?
A: There are a couple of big differences
that really matter. If you want users to be
able to bookmark pages that are the result
of submitting a form, then you have to use
GET, because there is no way to bookmark
a page that has been returned as a result of
a POST. When would you want to do that?
Say you have a server script that returns a
list of search results; you might want users
to be able to bookmark those results so they
can see them again without having to fill out
wouldn't want users to be able to bookmark
the page. (Otherwise, every time they
returned to the bookmark, the order would
A situation when you'd never want to use
a GET is when the data in your form is
private, like a credit card or a password.
Because the URL is in plain view, the private
information is easily found by others if they
look through your browser history or if the
GET somehow gets bookmarked.
Finally, if you use a <textarea>, you should
use POST, because you're probably sending
a lot of data. Both GET and POST requests
have a limit on the amount of data you can
send, but the limit on a POST request is
usually much larger.
With POST, on the other hand, the browser
actually creates a little data package and
sends it to the server.
On the other hand, if you have a server
script that processes orders, then you