Re: Sessions vs passing variables

From: Date: Mon, 22 Jul 2002 02:56:32 +0000
Subject: Re: Sessions vs passing variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-108798@lists.php.net to get a copy of this message
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... >

« previous php.general (#108798) next »