How do I print all POST results when a form is submitted? [duplicate]

Solution 1:

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>

Solution 2:

You could try var_dump:

var_dump($_POST)

Solution 3:

Simply:

<?php
    print_r($_POST);

    //Or:
    foreach ($_POST as $key => $value)
        echo $key.'='.$value.'<br />';
?>

Solution 4:

You may mean something like this:

<?php
    $output = var_export($_POST, true);
    error_log($output, 0, "/path/to/file.log");
?>