|
|
|
| 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 : |
10789 |
| 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>";
?>
|
|
| 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 | | | Display variables when a form is submitted using POST/GET Categories : PHP, Functions, Variables, Debugging | | | The following snippet gives complete info about all submitted
HTTP_POST_VARS and HTTP_GET_VARS Categories : Variables, HTTP, PHP | | | 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 | | | Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem | | | Function to check connection to MySQL and redirect to an error page if an error occurs Categories : MySQL, PHP, Debugging, Databases | | | IP Blocking Categories : PHP, Security, HTTP | | | How to preset a text string in a textarea input field Categories : HTML, HTML and PHP, PHP, Beginner Guides | | | A simple script to count and report hits and the last
modification time of an HTML page. Requires MySQL support
(other DBs should work too, except possibly mSQL). Categories : HTTP, MySQL, PHP, Databases | | | header -- Send a raw HTTP header Categories : PHP, PHP Functions, HTTP | | | How to let a user download a picture by clicking on it instead of needing to right click and Save-As. Categories : HTTP, PHP, HTML and PHP, Filesystem | | | How to control the number of decimal places when outputting numbers. Categories : PHP, Strings, Variables | | | This gets the http response headers for a given url and returns them in an assoc array. i.e. to test if a url exists: $array = get_http_headers($url); if($array[result]=200) { } Categories : HTTP, Arrays, PHP | |
|
|