Is it possible to print the results of a submitted form?
I need to see all of the POST
results that are submitted to the server for testing.
Which is an example of how i can create a new file for submitting that echos out all the fields which were submitted with the form?
It's dynamic, so some fields may have a name/ID of field1, field2, field3
, etc.
Best Answer
All the values are stored in the $_POST
collection
<?php print_r($_POST); ?>
or if you want something fancier that is easier to read use a foreach loop to loop through the $_POST
collection and print the values.
<table>
<?php
foreach ($_POST as $key => $value) {
echo "<tr>";
echo "<td>";
echo $key;
echo "</td>";
echo "<td>";
echo $value;
echo "</td>";
echo "</tr>";
}
?>
</table>