Possible Duplicate:
Invalid argument supplied for foreach()
How can I not to loop the key with empty value in an array?
For instance, I want to skip [submit] =>
or [submit] => add
from being looped in foreach
,
Array (
[cart] => Array ( [1386638969582999] => Array ( [quantity_stock] => 10 ) )
[submit] =>
)
the loop,
foreach ($_POST as $index => $array_items)
{
foreach($array_items as $id => $item)
{
$cart->add_item($id);
}
}
I get this error,
Warning: Invalid argument supplied for foreach() in C:... on line xx