0% found this document useful (0 votes)
56 views

PHP $ - GET Tutorial

The $_GET superglobal variable in PHP is used to collect form data from an HTML form submission with a method of "get" or from URL parameters. Data is collected from the URL and the parameter names and values can be accessed in the PHP code using $_GET. For example, if a link passes parameters "subject=PHP&web=W3schools" then those values can be echoed out in the PHP page using $_GET['subject'] and $_GET['web']. The $_GET superglobal is available in all PHP scopes and is useful for collecting URL parameter data.

Uploaded by

Thant Thant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

PHP $ - GET Tutorial

The $_GET superglobal variable in PHP is used to collect form data from an HTML form submission with a method of "get" or from URL parameters. Data is collected from the URL and the parameter names and values can be accessed in the PHP code using $_GET. For example, if a link passes parameters "subject=PHP&web=W3schools" then those values can be echoed out in the PHP page using $_GET['subject'] and $_GET['web']. The $_GET superglobal is available in all PHP scopes and is useful for collecting URL parameter data.

Uploaded by

Thant Thant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

  HTML CSS MORE  EXERCISES   

w3schools.com LOG IN

PHP Superglobal - $_GET


❮ Previous Next ❯

Super global variables are built-in variables that are always available in all scopes.

PHP $_GET
PHP $_GET is a PHP super global variable which is used to collect form data after submitting an
HTML form with method="get".

$_GET can also collect data sent in the URL.

Assume we have an HTML page that contains a hyperlink with parameters:

<html>
<body>

<a href="test_get.php?subject=PHP&web=W3schools.com">Test $GET</a>

</body>
</html>

When a user clicks on the link "Test $GET", the parameters "subject" and "web" are sent to
"test_get.php", and you can then access their values in "test_get.php" with $_GET.

The example below shows the code in "test_get.php":

Example
 <html>
 HTML CSS MORE  EXERCISES   
<body>

<?php
echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
?>

</body>
</html>

Try it Yourself »

Tip: You will learn more about $_GET in the PHP Forms chapter.

❮ Previous Next ❯

COLOR PICKER

SHOP

HOW TO

Tabs
Dropdowns
Accordions
Side Navigation
Top Navigation
Modal Boxes
Progress Bars

You might also like