Monday, January 30, 2012

Difference between GET and POST method in Form Submission

In HTML, we can specify two different submission methods for a form. The method is specified inside a form element, by using the "method" attribute.

GET and POST methods of a form is used to send data to the data processing page. Both methods are used in form data handling where each one has some difference on the way they work.

GET - POST methods comparision table:


GET Method Properties:


POST Method Properties:


1. All the name value pairs are submitted as a query string in URL.


1. All the name value pairs are submitted in the Message Body of the request.


2. Amount of data submitted is restricted.


2. Amount of data submitted is not restricted.


3. This is the default method used in the form tag.


3. Should be explicitly specified.


4. Get method is not secured (information appear in browser).


4. Post method is secured (information does not appear in the browser).


5. "GET" is basically for retrieving data.


5. "POST" is basically for sending data.


6. Data transmission is faster.


6. Data transmission is comparatively slow.



Simple Usage:

form id="myForm" name="myForm" action="myAction" method="GET" >...< /form >
form id="myForm" name="myForm" action="myAction" method="POST" >...< /form >

References:
1. http://www.w3schools.com/html/
2. http://en.wikipedia.org/wiki/POST_(HTTP)
3. http://wiki.answers.com/Q/What_is_the_difference_between_get_and_post_method_in_HTTP
4. http://www.wereyouwondering.com/what-is-the-difference-between-get-and-post/


No comments:

Post a Comment