www.webdeveloper.com
Results 1 to 3 of 3

Thread: Sessions: Page 1 vs Page 2

  1. #1
    Join Date
    Feb 2006
    Location
    Toronto
    Posts
    105

    Unhappy Sessions: Page 1 vs Page 2

    Hi webdevs!

    I am having a hard time with sessions. I bet it's because I don't REALLY understand the intricacies of PHP sessions, but I'm trying to hack my way through.

    I've got this simple 2 page system, an add to cart page (1) and a cart page (2).

    Procedure:
    - On page 1, submit a form and set $_SESSION['example']; through a function.
    - On page 1, successfully echo $_SESSION['example'];
    - On page 2, it fails to echo $_SESSION['example'];

    Isn't the point of a session to set a variable that can be accessed on any page of the site within a time frame?

  2. #2
    Join Date
    Feb 2006
    Location
    Toronto
    Posts
    105
    The only wildcard here is that I am in Drupal... not using Drupal sessions. I wouldn't think that would matter though.

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,175
    Did you do a session_start() on both pages, before any type of output is generated on either and before any usage of $_SESSION?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles