Re: Session Variable Problem
| From: | Mike Flynn | Date: | Thu, 11 Apr 2002 14:25:56 +0000 |
| Subject: | Re: Session Variable Problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13028@lists.php.net to get a copy of this message | ||
I'm a bit confused by your description. Seeing the code itself would be much more of a help. One thing that I notice though is that you say you session_register 'myvar' on the first page. But the value for myvar isn't actually set until after the form has been submitted, right? What might happen is that since myvar is set (assuming register_globals is on in your php.ini), on the 2nd page it's echoing the value of myvar from the submitted form, not from the session variable.
But like I said, it would help much more to see the snippits of code in question.. :)
-Mike
At 09:00 AM 4/11/2002 -0500, R.S. Herhuth wrote:
I'm running the latest build of php and Apache under Windows 2000 pro. I have been experimenting with sessions and I'm having a bit of trouble. page 1 I create a session_start() above all of the HTML. I have a 3 form element (a checkbox) with: name="myVar" value="1",name="myVar" value="2",name="myVar" value="3" I session_register("myVar") On submit I go to page two. page 2 I create a session_start() above all of the HTML. I echo $myVar this is where things get weird. The first time I run page 1, when I get to page 2 the value is passed correctly. If I use the browsers back button and change which checkbox I select and then click submit, the value doesn't change and the original value is printed out. If I reload the first page by rekeying in it's URL I get an error message saying that php expected a "," or ";" on line 23. That line is blank in the code and the syntax is correct and I didn't get an error the first time I ran the script. However if I refresh the page it reloads and runs, but again the value doesn't change when I submit it and view the printout on page two. If I set the form method to get and view the variable that is getting passed it looks correct but the session instance of the variable never changes. I have tried everything I could possibly try. I even copied and pasted sample code from www.zend.com with the exact same results. Is this a bug or what am I doing wrong? This is the most frustrating thing I have done in a long time. Ron Herhuth -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpMike Flynn - Burlington, VT http://www.mikeflynn.net/ - mike@mikeflynn.net home=>work=>home=>store=>home [repeat daily]