<code>
<?php

$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");

while (list ($key, $val) = each ($level)) {


        print "<tr>";
        print "<td width=\"30%\"><img src=./images/icons/" . $icon_array[$val] .
"></td>";
        print "<td>" . constant($val) . "</td>";
        print "</tr>";

}
?>

</code>

<error>
Warning: Variable passed to each() is not an array or object in
D:\projects\kf10\test65.php on line 43
</error>

Line 43 in the error output refers to the "while" control structure.  I can
not seem to define $level as the array $level_1 or $level_2, depending on
the $_SESSION['user']['level'] value (which can also be "1" or "2").  Any
thoughts on how to do this?  I tried using a switch statement like:

switch ($_SESSION['user']['level']) {
   case "1":
       $level = $level_1;
       break;
   case "2":
       $level = $level_2;
}

But this didn't work either.  Any help would be greatly appreciated.

-m

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

Reply via email to