This is a discussion on "Session variables" within the PHP Forum section. This forum, and the thread "Session variables are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Session variables
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Session variables
Hi, i've run across a problem when i try to
use session variables. I create a session variable in form1, for example session_start(); $_SESSION['my_var'] = 100; Then i should be able to access the above session variable in any subsequent pages, however, in some instances i get the error message: "Undefined index 'my_var' in.... I don't call session_destroy() in any of the subsequent scripts. It's an intermittent problem, if i try to recreate the steps which caused the error to occur, the error doesn't occur at all. Has anyone run into this type of problem? Thanks a lot, any help would be greatly appreciated. |
|
|
|
|||
|
Re: Session variables
1. Could your session be timing out?
2. Do you have another PHP based application running on the same server at the same time? If so, your sessions might be getting confused 3. Are you refusing or deleting cookies? 4. Your message is only a warning ... do you sometimes turn warnings off? Applications can sometimes appear to start in the middle while you're developing them if the session is set and you upload a fresh copy of the PHP page. It will start with $_SESSION in a different state to you would expect, and if you're using hidden fields or some other secondary mechanism as well as the session to maintain state, results can be very offputting. -- Graham |
|
|||
|
Re: Session variables
Re: timeouts:
I don't think so. Although i don't have access to php.ini, i assume it's using the default timeout value of 180mins. Re: other php scripts: I'll have to find that one out. But, shouldn't sessions be getting their own IDs everytime you call session_start() or session_register()? Re: cookies: Haven't changed anything in IE but will check this. Other sessions on other PCs get the same thing though. So i assume nothing has been changed in the browser settings. Thanks a lot for the response. Will continue trying to find out the cause. Am really perplexed. |
![]() |
| Tags |
| session, variables |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Problems with Session Variables... | JustinStudios | PHP Forum | 5 | Jan 17th, 2008 05:05 |
| Flash and PHP Session Variables | saxy46 | Flash & Multimedia Forum | 0 | Jan 27th, 2007 18:21 |
| Session Variables.... | courtjester | Classic ASP | 11 | Jul 6th, 2004 00:04 |
| Session Variables | ekendricks | Classic ASP | 4 | Dec 19th, 2003 06:33 |
| Session Variables | ekendricks | Classic ASP | 7 | Aug 26th, 2003 10:42 |