RE: [PHP] Sessions vs passing variables
| From: | John Holmes | Date: | Mon, 22 Jul 2002 03:19:52 +0000 |
| Subject: | RE: [PHP] Sessions vs passing variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108800@lists.php.net to get a copy of this message | ||
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