Using HTML Forms With PHP
By Nicholas Chase
2004-01-09
Reader Rating:

Accessing Form Value Collections
For those who are running older systems or want to get away from globals altogether, you have the option to use the $HTTP_GET_VARS and $HTTP_POST_VARS arrays. These collections are deprecated, but they are still available, and still in wide use. When they do go away, they'll be replaced by the $_GET and $_POST arrays, added in version 4.1.
Both of these arrays are of a type known as hash tables. A hash table is an array that is indexed by string values rather than integers. In the case of forms, the values are accessible by their name, as shown in Listing 3:
Listing 3. Accessing form values through hash tables
<?
$ship_value =
$HTTP_GET_VARS['ship'];
echo $ship_value;
echo "<br />";
$tripdate_value =
$HTTP_GET_VARS['tripdate'];
echo $tripdate_value;
echo "<br />"
;
$exploration_value= $HTTP_GET_VARS['exploration'];
echo $exploration_value;
echo "<br />";
$contact_value = $HTTP_GET_VARS['contact'];
echo $contact_value;
?>
|
You can use this method to retrieve values for each of your fields by name.
First published by
IBM developerWorks
If you found this article interesting, you may want to read these as well:
» Protecting your PHP and HTML Source Code
» Publishing Newsletters Using PHP & MySQL - 4
» Publishing Newsletters Using PHP & MySQL - 3
» Publishing Newsletter Using PHP & MySQL - 2
» Publishing Newsletters Using PHP & MySQL
» Unix Webserver Crontab Basics
|