Tutorial for $_GET in Super Global Variables

What is $_GET?

$_GET is a global variable that is used to collect data from an HTML form after it has been submitted. The data is visible in the query string when the form uses method get to transmit data, thus the values are not concealed. The values in the URL are stored in the $_GET super global array variable.

Web Development Course: PHP lecture 1

Example:-

Output:-

Right now, we’re just seeing half of the rationale. We’ve generated a linked image of Nainital Lake in the preceding code, which will take us to the picture.php page and provide the parameters name=”Nainilake” and city=”Nainital” to it.

That is, if we click on the little image of Nainital Lake, we will be brought to the next page picture.php, where the parameters will be displayed. These arguments will be given to the next page using the get method, and they will be shown in the address bar, as get is the default way. When we wish to transmit data to an address, we use a question mark (?) to connect them to the address.

The address has the name=Nainilake parameter connected to it. If we wish to add more values, we may do so by appending an ampersand (&) after each key-value combination, similar to how city=Nainital is appended after the name parameter. Now, when you click on the image of Nainital Lake, we want the picture.php page to appear, along with the value of the parameter.

$_POST vs $_GET

PHP Variables and scopes
Tagged : / / / / / / / / /