View Full Version : session information going between .html and .php files

Jul 19th, 2002, 06:35 PM
Just a quick question,

If I start a session in a php page and let the user add all sorts of info to it, then the user goes back to my index.html page then back to the php page, do I loose all that session data?


Jul 19th, 2002, 08:35 PM
Nope, shouldn't do.

The cookie should last for as long as the user has the browser open for, regardless where he/she goes.

Jul 20th, 2002, 01:49 AM
What I meant is if the user keeps their browser open and does the following:

1)goes to my home page
2)click on my php page (where I begin my shopping cart function and add items to the session)
3)goes back to my home page (.html)
4)goes back to my php page

On the return to the php page(4), (same browser session) are all the session variables that were set in the previous entry into the php page (2) available?

I'm thinking they are, but not sure.

Jul 20th, 2002, 04:13 AM
session variables exist for the length of the sesion (unless specified otherwise) which basically means for as long as they are in your site, so yes - session variables set in one php page will still be available even after visitng several html pages etc (in the same site) as long as the pages which need to access the session data all have the appropriate session_register("vars") set.

In fact if the user has cookies enabled they shoud even be able to go to a few other sites, come back and still be able to use the session data, but its best not to rely on that