Page 1 of 1

session problem

Posted: Wed Mar 19, 2008 6:26 pm
by mlecho
hi , i am trying to pass an array in a session, but i am not having much luck. the array will print_r() fine, so i know it is being built. But the issue is on the next page, i expect to see the same results....i only get Array()- any thoughts???

Code: Select all

 
//page 1
session_start();
$_SESSION['error']=array();
$error=$_SESSION['error'];
 
    $numerics=array($rf['zip'],$rf['contact_num'],$rf['dvd_qty'],$rf['vhs_qty']);
    for($b=0;$b<count($numerics);$b++)
    {
        $isnum=isNumeric($numerics[$b]);
        if(! $isnum)
        {
            
            $keyname=array_keys($rf,$numerics[$b]);
            array_push($error,$keyname);
        }
    }
$url=hostURL();
$extra = 'order_form.php';
header("Location: http://$url$extra");
 

Code: Select all

 
//page 2
<?php 
session_start();
print_r($_SESSION['error']);
unset($_SESSION['error']);
?>
 

Re: session problem

Posted: Wed Mar 19, 2008 6:39 pm
by Christopher
Make sure you know who did what to whom:

Code: Select all

//page 1
session_start();
 
    $error=array();
    $numerics=array($rf['zip'],$rf['contact_num'],$rf['dvd_qty'],$rf['vhs_qty']);
    for($b=0;$b<count($numerics);$b++)
    {
        $isnum=isNumeric($numerics[$b]);
        if(! $isnum)
        {
            
            $keyname=array_keys($rf,$numerics[$b]);
            array_push($error,$keyname);
        }
    }
    $_SESSION['error']=$error;
 
$url=hostURL();
$extra = 'order_form.php';
header("Location: http://$url$extra");

Re: session problem

Posted: Wed Mar 19, 2008 7:02 pm
by mlecho
nice----like budda!

thanks