Sessions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • learnPHP
    New Member
    • Mar 2008
    • 20

    Sessions

    Hi ,

    I am back with another small problem:

    I want to create a session in which i want to declare a session variable. I want to use the value of that session variable on the next two pages. This is the code that i have.
    1st page:
    Code:
    <?PHP
    session_start();
    session_register ("demo");
    if($_SERVER['HTTP_REFERER'] == "http://localhost/FAO_test/firms_WEB/Untitled-6.php")
      {
      $test=1;
      $_SESSION["demo"]= $test;
      }
      ?>
    2nd page
    Code:
    <?PHP
    session_start();
    if ($_SESSION['demo']== 1)
     include ("Untitled-7.php");
    ?>
    3rd page
    Code:
    <?PHP
    session_start();
    if ($_SESSION['demo']== 1)
     include ("Untitled-7.php");
    ?>
    But the problem is that the value of demo is not registering and i dont think the if statement in the 2nd and 3rd page is working. It displays the UNtitled-7.php even if demos value is not 1.

    Please tell me what i am doing wrong??
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Question moved to PHP forum.

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #3
      This has already been posted!!!

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        This is a double post. Youi have been warned via PM not to do that! This thread will be closed.

        moderator

        Comment

        Working...