Sharecodepoint popular queries

Wednesday, 15 January 2020

Difference between GET and POST method in PHP


GET & POST methods are superglobals which means they can easily access from any place anywhere. Get and Post method are very useful methods for form handling. Most of the developers prefer POST for sending form data. GET and POST, both methods are creating an array with key and value pairs. The name in the array is the form control field name the value is the entered data by the user.

GET & POST methods both are used as $_GET and $_POST. As they both are not required scope for their accessibility. We can access these methods anywhere in any function, any class or file as we do not need to do any functionality for the same.

If we simply say about $_GET is none other than an array of variables passed to script which is executing on that time via URL parameters.

The HTTP POST method is used in $_POST which is also an array of variables. When using Get method in form submission then the user information either names or values) is visible in URL to everyone. Get also has some specified limits of only 2000 characters i.e. it can send form data only within particular limits.

In GET it is possible to bookmark the page, as data is shown in  URL which is beneficial in some cases. GEt is always used for sending the data which is not private. As there is no security in getting because everything is displayed in URL. Hence sometimes we avoid Get while sending passwords and other private information.

On the other hand, information while sending with the POST method is not visible to the users. So, it is more secure than GET method.

 In the POST method, all the names and values are embedded in the HTTP request, as it is not visible to others. There is no specified limit for sending data. We can send an unlimited amount of characters while sending form data through the POST method.

As compared to the GET method POST supports advanced functionality.

In POST, while uploading files to the server it supports multi-part binary input. In the post, it is not possible to bookmark the page.

 In short, the secure method is the POST method for sending form data in comparison to the GET method.

0 comments:

Post a comment

 

Version 23.2.3.4 - 2016 - 2020 - © Sharecodepoint | Made in India. | Copyright Content | Facebook | Twitter | Instagram | Youtube