Letting a new PHP page know a new POST value is an Array?
- by Wintermute
I have a page that creates an associative array, then passes it as a hidden value to a new PHP page. I have a foreach loop waiting to iterate through it but it coughs up an "invalid argument" error, as if the page doesn't know the value it's working with is an array (Despite "print" showing simply "Array"). This is essentially what I have:
//Hidden input to be passed to the next page
print "<input type=\"hidden\" name=\"price_list\" value=\"$item_list\">
//Code on the second page for the foreach loop
extract($_POST);
foreach($price_list as $name=>$price) {
...
}
But I am simply given "Warning: Invalid argument supplied for foreach() in /home/cut/mg299/public_html/PHP/invoice.php on line 17". The array works fine, as I can iterate on the previous page, and other values are parsed fine to this second page.
Do I need to 'reinitialise' this array value?