·  PHP – Web Forms – Parameters – Initialize Automatically

 

- Info:

  - This tutorial shows how to automatically initialize each variable that has the same name as parameter in HTTP Request.

  - This feature is activated by setting php.ini directive:

    register_globals = On

  - This tutorial is based on http://www.brainbell.com/tutors/php/php_mysql/Passing_Data_with_URLs.html.

 

- 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 $name; ?> </br>

    Age  = <?php echo $age ; ?>