you are here
there are no
Why is it called “GET” if we’re
sending something to the server?
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 request.
With POST, on the other hand, the browser
actually creates a little data package and
sends it to the server.
So why would I use POST over
GET, or vice versa?
There’s 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 Web application 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 ﬁll out
On the other hand, if you have a Web
application that processes orders, then you
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
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. GET requests have a limit of
256 characters; POST has no limit on the
size of the data package you send.
Watching GET in action
There’s no better way to understand GET than to see it in action.
Open up your “form.html” ﬁle and make the following small change:
<form action=”http://www.starbuzzcoffee.com/processorder.php” method=”GET”>
Just change the method
from “POST” to “GET”.
Save and reload the page; then ﬁll out the form and submit it. You
should see something like this:
You’ll see this URL
in your browser.
Now you can see every
form element name
and their values right
here in the URL.
Notice that the browser encodes
various characters, like spaces. The
Web application will automatically
decode these when it receives them.