PHP GET Method

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 server logs. Here’s how it will be visible,

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

  • Never use GET, if you want to send passwords.
  • Information sent via 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, 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 that 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 free tutorials for all.

No Comments

Post A Comment