Forum Moderators: coopster

Message Too Old, No Replies

Get all set POST variables

         

rokec

7:07 pm on Feb 8, 2007 (gmt 0)

10+ Year Member



Is it possible to figure out which variable was set via POST in PHP?

cameraman

7:13 pm on Feb 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With the $_POST array
if(isset($_POST['variable_in_question'])) echo "yup";

For your thread title:
foreach($_POST as $vblname => $value) echo $vblname . ' = ' . $value . "<br />\n";
will dump the names which came in from post.

cmarshall

7:14 pm on Feb 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem.

The superglobal $_POST array contains all POSTed parameters.

ex:

$myparam = $_POST['myparam'];
will contain the value of
<input name="myparam" />

jatar_k

8:21 pm on Feb 8, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



echo '<pre>';
print_r($_POST);
echo '</pre>';

that will dump the whole POST array to the browser in a readable way