I have a function that assigns some session variables I need available during a user's visit. Oddly enough, as I assign about 7 variables, I noticed that not all had data. This is the function:
function setupUserEnv ($userArray) { $_SESSION['loggedIn'] = 1; $_SESSION['id'] = $userArray['id']; $_SESSION['uid'] = $userArray['uid']; $_SESSION['fname'] = $userArray['fname']; $_SESSION['lname'] = $userArray['lname']; $_SESSION['dateapproved'] = $userArray['dateapproved']; $_SESSION['email'] = $userArray['email']; } Pretty straight forward. I've used var_dump as soon as I enter the function to make sure $userArray is populated the way I expect - it always is. Only the session variables for 'loggedIn', 'uid' and 'dateapproved' stay set outside of this function. However, I can set a session var not used in my program in this function, and it'll stick: $_SESSION['justTesting'] = "test"; will stay set outside of this function. If I put a var_dump at the end of the function for $_SESSION, I see all session vars are set within the scope of the function. Once outside of the function, some stay set, some do not. I've read the chapter in the manual about variable scope, and it seems pretty clear that $_SESSION is a superglobal, and I do not have to declare it with the 'global' keyword. I've tested this on three separate installations of PHP/Apache, and I get the same behavior each time. Anyone clue me in to what I'm doing wrong? Thanks! -- Jeff Stillwall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php