custom session variables

Discussion in 'Troubleshooting' started by msolution, Jun 26, 2010.

  1. msolution

    msolution New Member

    Joined:
    Jun 26, 2010
    Messages:
    3
    Im trying to use session variables for one of my projects ,
    but they dont seem to hold, on the next page load the session variable is not there, all other variables of amember pro are there,

    Code:
    if(empty($_SESSION)) session_start();
    
    if(!isset($_SESSION['var1']))
    {
     $_SESSION['var1'] = 100;
     echo "set";
    }
    else
    {
     echo "get: ".$_SESSION['var1'];
    }
    
    it always ends up in the first loop.

    please advise.
    M.
  2. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    Start page with just - session_start();
  3. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    make sure that you have session_start() at the top of the page before any html code or php output.

Share This Page