PHP: What’s coming in from the form?
I posted how to do this in ASP, but since I needed something similar in PHP for that last post, I thought I’d post the PHP version as well.
This script snippet will play back everything that was just submitted in the form (code found in the each function page in the PHP manual.)
<?
echo “<p>Here is the data that was submitted in the form</p>”;
echo “<p>”;
while(list($key,$value) = each($_POST)) {
echo $key.”: “.$value;
echo “<br>”;
}
echo “</p>”;
?>
This assumes, in your form tag, you set method=”post”
June 11th, 2003 at 12:47 am
Although not as pretty, you can use:
<?php
print_r($_POST);
?>
which will give you something like this:
Array ( [name] => Joe Schmoe [address] => 123 Any Street [city] => Anytown [state] => NY [zip] => 12312 )
June 12th, 2003 at 2:22 pm
how would one do this with checkboxes to make sure there is a default value in a checkbox field?