Re: Sessions vs passing variables
| From: | Mike Mannakee | Date: | Mon, 22 Jul 2002 03:36:28 +0000 |
| Subject: | Re: Sessions vs passing variables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108803@lists.php.net to get a copy of this message | ||
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.
Mike
"John Holmes" <holmes072000@charter.net> wrote in message
news:001e01c2312e$a6149aa0$b402a8c0@mango...
> How are you testing whether the variables were passed or not? What
> version of PHP are you using and is register_globals ON or OFF?
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Mike Mannakee [mailto:mike@basementideas.com]
> > Sent: Sunday, July 21, 2002 10:57 PM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Sessions vs passing variables
> >
> > No,
> >
> > The strange thing is there isn't. I have a test page that links to
> the
> > order form, having this html:
> >
> > <form action="order_form.php" method="post">
> > <input type="hidden" name="prod_ids[]" value="9">
> > <input type="hidden" name="prod_ids[]" value="8">
> > <input type="hidden" name="prod_qtys[]" value="1">
> > <input type="hidden" name="prod_qtys[]" value="1">
> > <input type="submit" value="Order product"></form>
> >
> >
> > <p>
> > <a href=order_form.php?prod_ids[]=9&prod_qtys[]=1>Order</a>
> >
> > I've tried it here as both a link and as hidden forms. Neither on
> works
> > if
> > I begin the script with:
> >
> > if(!(session_id()))
> > session_start();
> >
> > I've actually figured a bit of a workaround by having the session
> begun on
> > earlier pages, and just continued on the order form. I think when a
> > session
> > is begun the server sends a cookie to the browser, and somehow that
> > transaction wipes out the variables, whether posted or passed by URL.
> > It's
> > a bit of a pain but it seems to be working. I'm just now slightly
> nervous
> > that the order form is unable to begin a session if it needs to, but
> one
> > lives, right?
> >
> > Mike
> >
> >
> > "John Holmes" <holmes072000@charter.net> wrote in message
> > news:001b01c2311f$e19a2cc0$b402a8c0@mango...
> > > > When I try to pass a variable from one page to another the
> variable is
> > > > completely inaccessible IF I have a session going. The data has
> to be
> > > > passed from one page to the next through the link, as the link
> tells
> > > which
> > > > product the user hit. Any thoughts?
> > >
> > > Is there a variable by the same name in the session? If
> register_globals
> > > is on, the session value could be overwriting the GET value.
> > >
> > > ---John Holmes...
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>