Re: Sessions vs passing variables

From: Date: Mon, 22 Jul 2002 04:06:31 +0000
Subject: Re: Sessions vs passing variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-108809@lists.php.net to get a copy of this message
Right, I understand I should be able to access them. That's the whole problem. They're not there. I can do one of two things and they magically become available: 1. Don't start the session. 2. Use single variables, not arrays. #2, however, would create a problem in that I intend to set it up that a person can have more than one item in their shopping cart. This hoses that, as I was planning on having the product ids passed as hidden fields so as not to have to rely on the session functions to keep items in the shopping cart. Mike "John Holmes" <holmes072000@charter.net> wrote in message news:002001c23131$e05a0670$b402a8c0@mango... > > I'm on a server with php version 4.2.1 with register globals on. The > main > > test has been can I access the variables in the script? Oddly enough, > if > > I > > didn't use an array they are there for me. Turns out it's only when > I'm > > trying to pass an array. Single variables works fine. I'm beginning > to > > think it's a bug. > > Why are you trying to use an array? The values are there, I imagine you > are just trying to access them incorrectly. > > > > > <a href=order_form.php?prod_ids[]=9&prod_qtys[]=1>Order</a> > > For that URL, which you should be using quotes around, you'll have > $_GET['prod_ids'][0] --> 9 and $_GET['prod_qtys'][0] --> 1. Or, > $prod_ids[0] --> 9, etc, since register_globals is on. > > ---John Holmes... >

« previous php.general (#108809) next »