DIFFERENCE BETWEEN GET AND POST METHODS?
The GET Method
The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ?character.
The GET method produces a long string that appears in your server logs, in the browser's Location: box.
The GET method is restricted to send upto 1024 characters only.
Never use GET method if you have password or other sensitive information to be sent to the server.
GET can't be used to send binary data, like images or word documents, to the server.
The data sent by GET method can be accessed using QUERY_STRING environment variable.
The PHP provides $_GET associative array to access all the sent information using GET method.
The POST Method
The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.
The POST method does not have any restriction on data size to be sent.
The POST method can be used to send ASCII as well as binary data.
The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using Secure HTTP you can make sure that your information is secure.
The PHP provides $_POST associative array to access all the sent information using POST method
- 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.
- 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.