0

I have a situtation where I need to use the variables created during a session on another page. currently, I am doing the queries twice, which seems like such a waste!
Is is possible to retrieve them via the session store?
This is my first foray into the bowels of session handling,etc, so be gentle...;)

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by hashinclude
0

if a session variable was set, you can access through $_SESSION

I guess I just don't understand what is being stored in a session.
For instance, don't the POST vars get stored in the session automatically?
If I create other PHP variables, those have to be stored and retrieved via my code?
Are those vars then destroyed upon the session /browser close or do i have to also write some cleanup code?

As i understand it, the session is used primarily to separate users on the site , keping track of resources being by that person specifically. Like i said , I'm just not real clear about how and when to use sessions.

0

session data and post data are different , and they are stored differently.
to use session data in a page, you must begin it with session_begin() function, and then you could save a variable in to the session by adding it to the $_SESSION array.

we could help and explain better if you posted the code you're having trouble with :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.