Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts

    session information going between .html and .php files

    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.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope, shouldn't do.

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

  • #3
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    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.

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    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
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •