GET:
- Parameters remain in browser history because they are part of the URL
- Can be bookmarked.
- GET method should not be used when sending passwords or other sensitive information.
- 7607 character maximum size.
Example:
http://www.test.com/index.htm?name1=value1&name2=value2
2 3 4 5 6 7 8 9 10 11 12 |
<form method="get" action="<?php echo $_SERVER["PHP_SELF"];?>"> <label for="inputName">Name:</label> <input type="text" name="name" id="inputName"> <input type="submit" value="Submit"> </form> |
POST:
- Parameters are not saved in browser history.
- Can not be bookmarked.
- POST method used when sending passwords or other sensitive information.
- 8 Mb max size for the POST method.
- It is more secure than GET because user-entered information is never visible in the URL query string or in the server logs.
Example:
http://www.test.com/index.htm
2 3 4 5 6 7 8 9 10 11 12 |
<form method="POST" action="<?php echo $_SERVER["PHP_SELF"];?>"> <label for="inputName">Name:</label> <input type="text" name="name" id="inputName"> <input type="submit" value="Submit"> </form> |
Pradeep Maurya is the Professional Web Developer & Designer and the Founder of “Tutorials website”. He lives in Delhi and loves to be a self-dependent person. As an owner, he is trying his best to improve this platform day by day. His passion, dedication and quick decision making ability to stand apart from others. He’s an avid blogger and writes on the publications like Dzone, e27.co