Msg#: 4274739 posted 5:13 pm on Mar 1, 2011 (gmt 0)
Hi folks - a newbie here, trying to get my head round PHP sessions.
I put session_start()in a script on main page of my website expecting the session to persist when the user looks at other pages of my site but this does not seem to be the case. The session appears to 'stop'.
If session cookies are enabled in php.ini i can get to the info by calling session_start() on another page and the cookie supplies the session id from the previous start up.
Is session_start a bit of a misnomer - should it be more like session_open - and should i try to the think of the session as a pseudo file that you open with session_start().
Or should it persist and i have set something incorrectly, perhaps.
I have Apache as a server on my PC and have set the site up on localhost.
Msg#: 4274739 posted 11:05 pm on Mar 1, 2011 (gmt 0)
I'm a newbie myself but I use sessions and relate to your post. You need to have session_start(); on all pages you want to use the session contents, ie session id.
The placement of session_start(); is important as well, I believe it should always be at the very top of the page which is where I put it but I've seen on occasion scripts that call in half way down the page.