.
Developer Spot - Web Development Tutorials
arrowDeverloper Spot  Tutorials  PHP  Using HTML Forms With PHP 
 
Development Tutorials
ASP
CGI & Perl
CSS
HTML
Java
JavaScript
Linux
PHP
XML




More Resources
Web Hosting Articles
Web Development News
PHP Manual
Web Hosting Directory
Budget Web Hosting Linux Web Hosting Small Business Hosting
Windows Web Hosting Reseller Web Hosting Web Hosting Articles

Using HTML Forms With PHP

By Nicholas Chase
2004-01-09
Reader Rating: 5 out of 5
Bookmark Print Version
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.


Article Pages:
Access Single and Multiple Form Values
The HTML Form
The Old Way: Accessing Global Variables
Accessing Form Value Collections
One Name, Multiple Values
The Amazing Disappearing Checkboxes
Getting All Form Values
One Final Note: Dots
Summary
Resources

First published by IBM developerWorks


 Rate this article:   Poor          Excellent 


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



 
Development Tutorials: CGI & Perl - CSS - HTML - Java - JavaScript - Linux - PHP - XML
More Resources: Web Hosting Articles - Web Development News - PHP Manual