This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

4.2.5 $_GET

  • 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: Test Get
    <html>
    <body>
    
    <?php
    echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
    ?>
    
    </body>
    </html>

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

    Navigate this module

    Eventually the navigation links, above, will be replaced by these << (previous) and >> (next) buttons below.



    Animated PHP icons used in the buttons provided by ICONS8.COM. Smartphone icons created by Freepik - Flaticon

    Module 4 quiz