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
using arrays in sessions variables
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Syntax:
Code: Select all
<?php
print $_SESSION[$FORM_VARS]["userLevel"];
?>
Last edited by McGruff on Wed Aug 10, 2005 11:10 am, edited 1 time in total.