PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mlecho
Forum Commoner
Posts: 53 Joined: Wed Feb 02, 2005 9:59 am
Post
by mlecho » Wed Mar 19, 2008 6:26 pm
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']);
?>
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Wed Mar 19, 2008 6:39 pm
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");
(#10850)
mlecho
Forum Commoner
Posts: 53 Joined: Wed Feb 02, 2005 9:59 am
Post
by mlecho » Wed Mar 19, 2008 7:02 pm
nice----like budda!
thanks