Powered by InterCreatives | Site Map
Search:
NewSourceMedia Popular Tutorials: PHP Javascripts Web Hosting
SoftwareTutorials
CATEGORIES
Job Listings
 
Home / PHP / Content Management

POST/GET Form Variables

Published by: Alexander Mclean III


Introduction:

To view all of the POST/GET Variables, you could use the following PHP statements.

NOTE: Make sure that "REGISTER_GLOBALS" are turned ON and DO NOT USE (enctype="text/plain") in your form tag or you may not be able to retrieve the posted values.

print_r($_POST);
?>

or

print_r($_GET);
?>

or you may want to see all POST/GET variables including global variables like cookies set by your web site.

print_r($_REQUEST);
?>

Here is a sample as to how the data will display after posting your form by using the above PHP statements:

Array ( [textfield1] => Alexander [textfield1] => 1 [submit] => Submit )

If you would like to change the way your POST/GET Array variables are displayed, you could do the following:

echo "POST/GET Variables:
";
foreach ($_GET as $key => $val)
echo "$key =$val
";
?>

The the code above should display something like this:

POST/GET Variables:
textfield =Mike
textfield2 =Tome
textfield3 =Sue
textfield4 =Bob
Submit =Submit

To view a working sample using the GET method, click here!


Next PHP Page:
1  2  3  4  5  6  7  [8]  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32 





Hosting by iPowerWeb.com - 50 Gb for $7.95