Re: Can I do this? If so why wont it work

From: Date: Fri, 16 Jan 2004 21:31:14 +0000
Subject: Re: Can I do this? If so why wont it work
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174882@lists.php.net to get a copy of this message
----- Original Message ----- From: "Alex Hogan" <Alex.Hogan@AlliedElec.com> To: "PHP General list" <php-general@lists.php.net> Sent: Friday, January 16, 2004 4:20 PM Subject: [PHP] Can I do this? If so why wont it work > I am wanting to read in several session values at once. > > > > This is what I have so far; > > > > $_SESSION['obj[1]'] = $_REQUEST['txtObj1']; > > $_SESSION['obj[2]'] = $_REQUEST['txtObj2']; > > $_SESSION['obj[3]'] = $_REQUEST['txtObj3']; > > $_SESSION['obj[4]'] = $_REQUEST['txtObj4']; > > $_SESSION['obj[5]'] = $_REQUEST['txtObj5']; > > > > $i = 1; > > while ($i <= 5) { > > $obj_ar[$i] = $_SESSION['obj[$i]']$i++; > > } > > > > I keep getting this error; > > Parse error: parse error, unexpected T_VARIABLE in mypage.php on line 24 > > > > Where am I making the mistake? > > > > alex hogan > > > > > > ****************************************************************** > The contents of this e-mail and any files transmitted with it are > confidential and intended solely for the use of the individual or > entity to whom it is addressed. The views stated herein do not > necessarily represent the view of the company. If you are not the > intended recipient of this e-mail you may not copy, forward, > disclose, or otherwise use it or any part of it in any form > whatsoever. If you have received this e-mail in error please > e-mail the sender. > ****************************************************************** > > > What is on line 24? Try this: while ($i <= 5) { $obj_ar[$i] = $_SESSION['obj[$i]']; $i++; } Jake

« previous php.general (#174882) next »