Forum Moderators: coopster
foreach($_POST as $key => $value){
if (is_array($value)) {
echo "$key = ";
foreach ($value as $a) {
echo "<i>$a, </i>";
}
}else{
echo "$key = $value<br>";
}
}
which works fine but it puts the results of the arrays all on the same line like so:
firstArray = 2, 3, secondArray = 4, 6, 8, thirdArray - 5, 7
But what I need to do is put each array and it's result on a separate line like the non-array values are:
firstArray = 2, 3,
secondArray = 4, 6, 8,
thirdArray - 5, 7
How can I adapt my code to accomplish this? I've read a ton of PHP tutorial coding pages but none address the formatting of the results I seek.
When I use the foreach loop, I get all the variables passed by the form. How can I excluded selected ones from being processed by the foreach loop? I'm looking to not be printing out the $_POST[formname], $_POST[env_reports], etc onto the page output but can't figure out how to exclude them from the loop.