Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    21

    Unanswered: PHP Session Disappears

    I have two files, file1.php and file2.php. file1.php calls file 2.php. The contents of the sesion variable ("TWO") appear in file1.php, but not in file2.php, so it is not getting passed along. I have seen this question posted in numerous forums, but still don't know what to do.

    /// file1.php

    <?php $_SESSION["test"] = "TWO"; ?>
    <html>
    <body>
    ONE <?php echo $_SESSION["test"]?> THREE
    <a href="file2.php">go</a>
    </body>
    </html>

    /// file2.php

    <html>
    <body>
    ONE <?php echo $_SESSION["test"]?> THREE
    </body>
    </html>

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Try some thing like this.
    Your session may not be starting up.
    add this line in the starting of the ur second page.
    session_start();
    This should work

    Regards
    Rajesh

  3. #3
    Join Date
    Apr 2003
    Posts
    21
    Quote Originally Posted by rajesh_r_r
    add this line in the starting of the ur second page.
    session_start();

    Regards
    Rajesh
    Yes, it does. Thank you. (I actually have it in both files now.)

Posting Permissions

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