I need to see all of the POST
results that are submitted to the server for testing.
What would be an example of how I can create a new file to submit to that will echo out all of the fields which were submitted with that form?
It's dynamic, so some fields may have a name/ID of field1, field2, field3
, etc.
Simply add echo "<pre>"; before the var_dump() or print_r().
Try var_dump($_POST); to see the contents. If your post data is in another format (e.g. JSON or XML, you can do something like this: $post = file_get_contents('php://input'); and $post will contain the raw data.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With