I have a POST in PHP for which I won\'t always know the names of the variable fields I will be processing.
I have a function that will loop through the values (howev
You can have the foreach loop show the index along with the value:
foreach ($_POST as $key => $entry)
{
print $key . ": " . $entry . "
";
}
As to the array checking, use the is_array() function:
foreach ($_POST as $key => $entry)
{
if (is_array($entry)) {
foreach($entry as $value) {
print $key . ": " . $value . "
";
}
} else {
print $key . ": " . $entry . "
";
}
}