Saturday, August 11, 2012

Show form element values in PHP



The below code reads all form variables and prints them. 

<?php
$keys =array_keys($_POST); // store all variable names into a numericaly indexed array begining at 0
for ($i =0; $i <count($keys); $i++) // go trought the created array and do....
{
echo $keys[$i] . ": " . $_POST[$keys[$i]] . "<br>\n"; // print data in the format var_name: var_value
}
?>


No comments:

Post a Comment