Friday, 22 July 2011

Get vs Post

So, when should one method be used instead of the other? Well, the POST method is used to submit data from a form that should be sent in only once, such as signing up for a newsletter or entering address information. The GET method is useful for storing data in the URL so that after submitting the data, someone could bookmark the resulting URL and return to it later, saving all the settings. In fact, it's possible to combine both methods in one form:
POST data is sent in the page body
When you wish to submit a form containing many fields, which would otherwise produce a very long URL, the standard solution is to use the POST method rather than the GET method
As a rule of thumb, if a piece of information isn't needed to regenerate the same page as a result of returning to a favorite or bookmark, then it doesn't belong in the URL and POST should be used.
reference : http://www.cs.tut.fi/~jkorpela/forms/methods.html

No comments:

Post a Comment