> $level = '$level_' . $_SESSION['user']['level'];
> //Where $_SESSION['user']['level'] can equal "1" or "2"
>
> $level_1 = array("PN", "GALUP", "VP", "PUBUP", "STATS", "MCI", "CONLIST",
> "CP", "OAFS", "LO");
> $level_2 = array("PN", "GALUP", "VP", "PUBUP", "MCI", "CONLIST", "CP",
> "OAFS", "LO");

I can see two problems with your code:

1) The syntax for assigning to $level is wrong.
Rather than:
    $level = '$level_' . $_SESSION['user']['level'];
your code should read:
    $level = ${'level_' . $_SESSION['user']['level']};
For more information on this syntax, see:
http://us2.php.net/manual/en/language.variables.variable.php

2) You are assigning $level_1 or $level_2 (depending on the value of
$_SESSION['user']['level']) to $level *before* you have assigned $level_1 or
$level_2 any values. There's no point making $level = $level_1 if $level_1
hasn't been defined yet.

Working code would be:

$level_1 = array("PN", "GALUP", "VP", "PUBUP", "STATS", "MCI", "CONLIST",
"CP", "OAFS", "LO");
$level_2 = array("PN", "GALUP", "VP", "PUBUP", "MCI", "CONLIST", "CP",
"OAFS", "LO");
$level = ${'level_' . $_SESSION['user']['level']};

Hope it helps,

Al

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to