| re: $_SESSION $_POST
On 11 Jan 2005 13:58:08 -0800, "Quinonez" <quinonez@gmail.com> wrote:
[color=blue]
>i set up a multipage form about a month ago using Sessions everything
>worked well and i moved forward with working on other pages i just
>checked the form to make sure it is all working properly and its giving
>me an error:
>
>Warning: Invalid argument supplied for foreach() in
>/home/mastersc/public_html/testthis.php on line 24
>
>this is the code:
>
><?
>ksort($_SESSION);[/color]
Is session.auto_start turned on? Shouldn't you call session_start() first?
[color=blue]
>foreach ($_SESSION as $page=>$_POST)[/color]
This seems a little odd - you're overwriting the superglobal variable $_POST
with the contents of the session array values?
[color=blue]
>{
>echo "<div class=\"h3\">$page</div><br>";
>foreach ($_POST as $field=>$value) <--this would be line 24-->[/color]
The error basically implies $_POST is not an array at this point. Dump it out
with var_dump/print_r, along with $_SESSION from earlier.
[color=blue]
>{
> echo "$field: $value<br>";
> }
>}
>?>
>
>any suggestions?[/color]
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool |