using arrays in sessions variables
Posted: Fri Nov 07, 2003 2:50 pm
I am having a hard time accessing data that is stored in an array in a session variable. I have a book that shows how to do this, but in the book they have global variables set to on, which I don't and would rather not have it.
By looking at the session object it can be seen that all the values are being stored properly so...
This is what I am doing at the moment, so obviously this is what does not work:
[php_man]
//store the variables in a local array var
foreach ($HTTP_POST_VARS as $varName=>$value)
{
$form[$varName] = trim(clean($value,50));//trim(clean($_POST["userName"],50));
}
$_SESSION["FORM_VARS"] = $form;
//this is the part that never prints the variable that I refer to
print "UserLevel";
print $_SESSION[$FORM_VARS["userLevel"]];
[/php_man]
I would really appreciate it if someone could look this over, because I have spent way to loing trying to figure it out
By looking at the session object it can be seen that all the values are being stored properly so...
This is what I am doing at the moment, so obviously this is what does not work:
[php_man]
//store the variables in a local array var
foreach ($HTTP_POST_VARS as $varName=>$value)
{
$form[$varName] = trim(clean($value,50));//trim(clean($_POST["userName"],50));
}
$_SESSION["FORM_VARS"] = $form;
//this is the part that never prints the variable that I refer to
print "UserLevel";
print $_SESSION[$FORM_VARS["userLevel"]];
[/php_man]
I would really appreciate it if someone could look this over, because I have spent way to loing trying to figure it out