SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: session problem

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    scarborough
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    session problem

    I have tried using the session command with little sucess. I have two pages session1.php and session2.php and links back and forth between the two. The variable should increase each page but it doesn't. I am not sre what I am doing wrong. Here is the code

    PHP Code:
    <?php @session_start();?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD></head><body>


    <?php

    if(isset($_SESSION['views']))
    {
     
    $ss=$_SESSION['views'];
    $ss=$ss+1;
    $_SESSION['views']=$ss;
    }
    else
        
    $_SESSION['views'] = 1;

    echo 
    "views = "$_SESSION['views']; 


    ?>
    <a href="session2.php">page 2</a>

    </BODY>
    </HTML>

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    What does session2.php contain? Same thing?

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    scarborough
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes session2.php contains roughly the same thing except session2.php links back to session1.php

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    Try taking the @ out of in front of session_start and see if it kicks an error at you?

  5. #5
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    plz start the session on the session2.php page as well.....


Bookmarks

Posting Permissions

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