- The
GET method
suse to pass arguments from
one page to another of next page as part of the Uniform Resource
Indicator(URI).
- GET appends the indicated variable name(s) and value(s) to
the URL designated in the ACTION attribute with a question mark
separator and submits the whole thing to the processing agent.
- When the user clicks the Submit button, the browser
arrange in order,with no spaces between the elements: The URL in
quotes after the word ACTION
(http://localhost/test.php)
- A question mark (?) denoting that the following
characters compose a GET string.
- A variable NAME, an equal sign, and the matching VALUE
(name=ABCD).
- An ampersand (&) and the next NAME-VALUE pair
(Submit=Select),further name-value pairs separated by ampersands
,it can be added as many times as the server querystring(length
of string limit allows).
Example :
<form action="test.php" method="get">
Name: <input type="text" name="name">
City: <input type="text" name="city">
<input type="submit">
</form>
Note :
When the user clicks the "Submit" button, the URL sent to the server
something like this:
http://www.tkhts.com/First/test.php?name=TechKnow&city=Delhi
DrawBacks :
- The GET method is secure for logins because the username
and password are fully visible onscreen as well as stored in the
client browser's memory as a visited page.
- Every GET submission is recorded in the Web server log,
data set included.
- Because the GET method assigns data to a server
environment variable, the length of the URL is limited.
POST method
is used for form submission
today, particularly in nonidempotent usages, such as adding
information to a database.
- The form data set is included in the body of the form when
it is forwarded to the processing agent.
- It does no visible change to the URL will result according
to the different data submitted.
Example :
<form action="test.php" method="post">
Name: <input type="text" name="name">
City: <input type="text" name="city">
<input type="submit">
</form>
Note :
When the user clicks the "Submit" button, the URL sent to the server
something like this:
http://www.tkhts.com/First/test.php