When to use "get" or "post"?
The "get" and "post" methods of a form control whether the results in a form should be URL encoded or not, as you may most likely know.
Use the "get" method when you want somebody to be able to do an action when it is URL encoded. Scripting can help. For example, if you created a search engine, you'd want to have the result URL encoded. For example:
www.example.com/search?searchword=themadcomputer
If you designed your coding so that "searchword" would be the word entered into the search box, anybody could search from the address bar or at your search box, and the contents of the variable "searchword" would be looked up with the engine. See what I'm saying? If the "searchword" variable read "yosemite", then it would be looking up the word "yosemite" and displaying results on that subject.
But now use the "post" method for sensitive data, like signup pages and email submissions. You don't want people to see the history and find something like "www.example.com/signup/signedup?username=themadcomputer&password=MypassWord12&email=someone@example.com" because then they'd know what the password was and could basically click on that URL and it would repeat the signup (basically, you'd actually want the page to validate results anyways). But see?
A very useful tip.
No comments:
Post a Comment
Please keep your comments appropriate.