|
|
|
| Title : |
Script to check values being submitted by POST or GET method from a form. This script may help diagnose what variables are being supplied by a browser to other php scripts. |
| Categories : |
HTML, Variables, Debugging, PHP, HTTP |
 Nick Talbott |
| Date : |
Aug 13th 1998 |
| Grade : |
2 of 5 (graded 4 times) |
| Viewed : |
8700 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Nick Talbott |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
<?php
// To check output from a form, set the <FORM ACTION=".." to point to this script
// This script relies on the php configuration directive track_vars being enabled
// See chapter 4 of the PHP manual
print "Summary of information passed from " . urldecode($HTTP_REFERER) .
"<br><hr>HTTP Headers:<p>";
$headers = getallheaders();
while (list($header, $value) = each($headers))
print "$header: $value<br>\n";
print "<hr>";
print "Values submitted via POST method:<p>";
if ($HTTP_POST_VARS)
{
for(reset($HTTP_POST_VARS); $key = key($HTTP_POST_VARS); next
($HTTP_POST_VARS))
{
if (is_array($HTTP_POST_VARS[$key]))
{
$num=count($HTTP_POST_VARS[$key]);
for ($i=0; $i<$num; $i++)
print "$$key"."[$i] = ".$HTTP_POST_VARS[$key][$i]."<br>
\n";
}
else
{
print "$$key = ".$HTTP_POST_VARS[$key]."<br>\n";
}
}
}
print "<hr>";
print "Values submitted via GET method:<p>";
if ($HTTP_GET_VARS)
{
for(reset($HTTP_GET_VARS); $key = key($HTTP_GET_VARS); next($HTTP_GET_VARS))
{
if (is_array($HTTP_GET_VARS[$key]))
{
$num=count($HTTP_GET_VARS[$key]);
for ($i=0; $i<$num; $i++)
print "$$key"."[$i] = ".$HTTP_GET_VARS[$key][$i]."<br>
\n";
}
else
{
print "$$key = ".$HTTP_GET_VARS[$key]."<br>\n";
}
}
}
print "<hr>";
?>
|
|
| The following snippet gives complete info about all submitted
HTTP_POST_VARS and HTTP_GET_VARS Categories : Variables, HTTP, PHP | | | Display variables when a form is submitted using POST/GET Categories : PHP, Functions, Variables, Debugging | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | The first step Guest Book ... ^^ Categories : MySQL, PHP, Apache, HTML, HTTP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | How to know which input button of type image was pressed in a form with
multiple image buttons (_x and _y) in PHP? Categories : PHP, Variables, HTML | | | Simple script to passing persistent and growing array between recalls of one page (manipulate little stack). Categories : Arrays, Global Variables, PHP, HTML and PHP, Variables | | | A simple class with some HTML output functions that would come in handy for consistent page layout etc. Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation | | | How to display a PHP variable value from a selectbox without reloading the
page by merging PHP and Javascript variables. Categories : PHP, Java Script, Variables | | | Simple Password example Categories : PHP, Authentication, Security, HTTP | | | Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays | | | header -- Send a raw HTTP header Categories : PHP, PHP Functions, HTTP | | | translate.php - Assocciative array example, passing a reference to a function. Categories : PHP, Arrays, Languages, Variables | | | BBCode Formatting String Categories : PHP, HTML, Regexps, Arrays | | | getting the name of the current script and query string Categories : PHP, Global Variables, Variables, URLs | |
|
|
|