What are the basic difference between get and post method in php?
In form submission with GET method, browser constructs a URL by taking the value of the action attribute appending a? to it, then appending the form data set (encoded using the application/x-www-form-urlencoded). The browser then processes this URL as if following a link (or as if the user had typed the URL directly).
Submission of a form with POST method causes a POST request to be sent, using the value of the action attribute and data will treated according to the content type specified by the enctype attribute.
Here are the list of some differences between GET and POST methods.
1) GET allows only ASCII characters whereas no restrictions in POST, binary data (images and other files) is also allowed.
2) History of last data sent remain in browser history using GET but POST method never remain history.
3) GET data can be cached but POST never cached.
4) It is easier to hack data in GET method with respect to POST.
5) In GET a complete URL string with data can be bookmarked, but it can’t happen in POST.
6) In GET application/x-www-form-urlencoded encoding is possible but POST can opt multipart/form-data as well.
7) GET requests are re-executed. The browser usually alerts the user that data will need to be re-submitted using POST data.
8) In GET 2000 character maximum size (depends on browser).8 MB max size for the POST method.
9) GET method is visible to everyone (it will be displayed in the browser’s address bar) and has limits on the amount of information to send.
POST method variables are not displayed in the URL.
10) GET is less secure compared to POST.
11) GET method should not be used when sending passwords or other sensitive information.
12) There are restrictions on form data length in GET.