echo $_POST["name"]; //returns the value a user typed into the "name" field
I would like to be able to also return the text of the key. In this example, I want to return the text "name". Can I do this?
echo $_POST["name"]; //returns the value a user typed into the "name" field
I would like to be able to also return the text of the key. In this example, I want to return the text "name". Can I do this?
$_POST is just a normal associative array so you can also loop over the entire thing like this:
foreach($_POST as $key=>$value)
{
echo "$key=$value";
}
while( list( $field, $value ) = each( $_POST ) {
echo "<p>" . $field . " = " . $value . "</p>\n";
}