PHP POST Method

For sending information to the web server, which is secure, use the PHP POST method. The information sent through the server isn’t visible in the URL, unlike the PHP GET() method.

Let’s learn about some interesting points about the POST method,

  • Use POST, if you want to send passwords.
  • Information sent via the GET method is hidden and can’t be seen in the URL.
  • There is no limitation on characters while sending information through POST.
  • PHP superglobals $_POST is used to collect form data with POST.
  • You can send ASCII as well as binary data, via GET.

Example

Here, we have two files. The first one is an HTML form,

HTML Form

The second file is success.php which will open if the form submission is successful. We’re using superglobal variable $_POST to collect form data with POST.

Here, you can see the variable values name and age aren’t visible in the address bar. One of the benefits of using the POST method is that it is secure since the values are hidden.

PHP POST Method

PHP GET Method
PHP Functions
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading