faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

35 of 41 people (85%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How would I find the variables that were posted from a generic form without knowing the variable names using the post method?

Jun 15th, 2000 02:52
Erik Johansson, Vince Bird, http://www.php.net/FAQ.php#7.1


This will display every item in the form that has the NAME tag set. This 
mean that even the submit button will be displayed if named. 
$HTTP_POST_VARS depends on track-vars which is enabled at compile time, 
or at the top of the PHP script with <?php_track_vars?>. (n.b. 
HTTP_GET_VARS, also exists.)
<?php
if(isset($HTTP_POST_VARS))
{
        while(list($var, $val) = each($HTTP_POST_VARS))
        {
                echo "$var<br>";
        }
}
?>