·  PHP – Web Forms – Parameters – Read from global array

 

- Info:

  - This tutorial shows how to read HTTP Request parameters.

  - $_POST   ['name'] reads parameters from POST HTTP Requests.

  - $_GET    ['name'] reads parameters from GET HTTP Requests.

  - $_REQUEST['name'] reads parameters from both GET and POST HTTP Requests.

 

- Example:

  - Create PHP Web Application Test.php

  - Create Test.html in the same directory.

  - Test it by submiting Test.html form.

  - Test it by calling HTTP GET Request http://localhost/Test.php?name=ivor&age=65.

      

    Test.html

    <form action="Test.php" method="post">

      Your name: <input type="text" name="name"/>

      Your age:  <input type="text" name="age" />

                 <input type="submit"          />

    </form>

 

    Test.php

    Name = <?php echo $_REQUEST['name']; ?> </br>

    Age  = <?php echo $_REQUEST['age' ]; ?>