...

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



bcarl314
07-19-2002, 05: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?

Thanks.

Mouldy_Goat
07-19-2002, 07: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.

bcarl314
07-20-2002, 12: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.

firepages
07-20-2002, 03: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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum