Strange error....
OK - my group is finalizing a website and we have a convoluted form ... and when we moved it from our server to the end clients we started getting the error:
Warning: Invalid argument supplied for foreach() in /usr/local/www/vhosts/mtrinc.com/htdocs/m irror/inquiry_handler.php on line 112
Here is the relevant code
$section = array();
$labels = array();
$message = array();
foreach ($_POST as $key => $val)
{
$section[] = $key;
foreach ($val as $tit => $dat)
{
$labels[] = $tit;
$message[] = $dat;
}
}
UPDATE:
- It works on the testing server, but not on the live server
- I have verified that there is POST data. Plus, there is a test for POST data at the top.
- all the form cells have names like "something[]" so $ val is always an array.
- have also declared $val, $labels, $message as arrays
I need to find out why this would work on one server and not on the other.
Anyone have any ideas?
Warning: Invalid argument supplied for foreach() in /usr/local/www/vhosts/mtrinc.com/htdocs/m
Here is the relevant code
$section = array();
$labels = array();
$message = array();
foreach ($_POST as $key => $val)
{
$section[] = $key;
foreach ($val as $tit => $dat)
{
$labels[] = $tit;
$message[] = $dat;
}
}
UPDATE:
- It works on the testing server, but not on the live server
- I have verified that there is POST data. Plus, there is a test for POST data at the top.
- all the form cells have names like "something[]" so $ val is always an array.
- have also declared $val, $labels, $message as arrays
I need to find out why this would work on one server and not on the other.
Anyone have any ideas?
SOLVED: turns out a tracking variable added later is not a an array. Sheesh. Thanks for all the help :D
