Using PHP array functions to view all of your POST/GET Variables make it easy for retrieving data from online forms. It’s also great for debugging your codes.
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:
To view a working sample using the GET method, click here!