Page 1 of 1
session accessing
Posted: Fri Mar 19, 2004 1:22 pm
by call
I declared session in page with session_start() and defined their variables.
in the subsequent pages I am unable to access that variables unless I declare again as session_start(). Plz help me understanding this.
Posted: Fri Mar 19, 2004 2:56 pm
by penguinboy
Posted: Sat Mar 20, 2004 3:36 pm
by McGruff
Penguinboy: if you want to post a link can you do it a little less rudely?
Call: that's the way it works ie you call session_start() in every new script, anywhere you like before any client output.
Posted: Sat Mar 20, 2004 7:09 pm
by call
if I declare session_start() in every page , does it not mean that everytime a new session to start?
Posted: Sat Mar 20, 2004 7:21 pm
by McGruff
call wrote:if I declare session_start() in every page , does it not mean that everytime a new session to start?
Sessions don't really exist - it just looks like they do.
Session variables are saved in a file after each http request.
On the next http request a session file is opened based on session ID - either sent via GET or stored in a cookie. That's what session_start() does: tells the server to go and unserialise a bunch of vars stored in a particular file (or create a new file if this is the first http request in the session).