Re: Array in a $_session

From: Date: Tue, 17 Jun 2003 05:23:28 +0000
Subject: Re: Array in a $_session
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-151780@lists.php.net to get a copy of this message
Hi John and maybe other that can look at the following, See below; I've got a session_start() on page2 because i'm retrieving ($aantalpers) an session value of step1.php and that is properly displayed on page2. Still nothing is displayed... Full code displayed below; any thoughts! Thanks for your time everyone to have a look at this! Regards, Frank (step 2.php) <? session_start(); $aantalpers=$_SESSION["aantalpers"]; $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:""; if($_REQUEST['submit']!="") { session_start(); foreach($_POST['test1'] as $i => $Value) { $_SESSION['test1'][$i] = $_POST['test1'][$i]; } session_write_close(); header("Location: step3.php"); } ?> <form name="form1" method=post id=form1 enctype=multipart/form-data action=<?=$_SERVER['PHP_SELF']?>> <? for ($i=1; $i<=$aantalpers; $i++) { ?> echo "<input type=\"text\" name=\"test1[$i]\" size=\"6\"><br>"; } ?> <input type=submit name=submit value=submit> </form> (step 3.php) <? session_start(); $aantalpers=$_SESSION["aantalpers"]; $test1 = $_SESSION['test1'][$i]; echo $test1; for ($i=1; $i<=$_SESSION['test1'][$i]; $i++) { echo $test1; } ?> ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "Frank Keessen" <fkeessen@planet.nl> Cc: <php-general@lists.php.net> Sent: Tuesday, June 17, 2003 4:06 AM Subject: Re: [PHP] Array in a $_session > Frank Keessen wrote: > > > Hi jason & the rest, > > > > Dit the session_write_close()! Nothing still displayed in step3, more > > thoughts?? > > > > > > $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:""; > > if($_REQUEST['submit']!="") > > { > > foreach($_POST['test1'] as $i => $Value) { > > $_SESSION['test1'][$i] = $_POST['test1'][$i]; > > } > > session_write_close(); > > header("Location: step3.php"); > > Do you have a session_start() on page 2? > > > (step 3) > > > > session_start(); > > $aantalpers=$_SESSION["aantalpers"]; > > $test1 = $_SESSION['test1'][$i]; > > echo $test1; > > for ($i=1; $i<=$_SESSION['test1'][$i]; $i++) > > { > > echo $test1; > > } > > Do a print_r($_SESSION); on page 3 to see what's in your session. What > is $i on page 3? I don't see where you set it. > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > PHP|Architect: A magazine for PHP Professionals – www.phparch.com > > > >

« previous php.general (#151780) next »