PHP GET Method

For sending information to the web server, use PHP GET method. It produces a long string, whenever you send information. This string can be seen in the address bar as well as in server logs. Here’s how it will be visible,

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

  • Never use GET, if you want to send passwords.
  • Information sent via the GET method isn’t hidden and can be seen in the URL.
  • There is a limitation of 1024 characters while sending information through GET.
  • PHP superglobal variable $_GET is used to collect form data with GET.
  • You can never send images, or documents, to the server, via GET.

Example

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

Here’s the output,

HTML Form example

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

Here, you can see the output. The URL shows the name and age information since we used the GET method. There’s a limitation of 1024 characters while sending information through GET. And since you can see the information in the URL, it is considered insecure. So, never use GET to send passwords.

PHP GET Method

PHP String Handling
PHP POST Method
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