Difference Between Get and Post Method in PHP ?
$_GET Method | $_POST Method |
---|---|
GET requests can be cached. | POST requests are never cached. |
GET requests remain in the browser history. | POST requests do not remain in the browser history. |
Easier to hack for script kiddies. | More difficult to hack. |
Restrictions on form data type. Only ASCII characters allowed. |
No restrictions. Binary data is also allowed. |
GET requests can be bookmarked. | POST requests cannot be bookmarked. |
GET is less secure compared to POST because data sent is part of the URL. So it’s saved in browser history and server logs in plaintext. |
POST is a little safer than GET because the parameters are not stored in browser history or in web server logs. |
GET requests have length limitations. | POST requests have no limitations on data length . |
GET method should not be used when sending passwords or other sensitive data. GET requests is only used to request data (not modify). |
POST method used when sending passwords or other sensitive data. |
Sample Code |
Sample Code |