Forum Moderators: coopster

Message Too Old, No Replies

Session, link to next page using database info

         

oceanwave

4:05 pm on Mar 4, 2004 (gmt 0)

10+ Year Member



Hi,
First name and last name are correctly inserted in page. user_level says 2 in the database. When I click on the link shown to go to the next page, it is incorrect (goes to [mysite.org)....] What am I doing wrong? Thank You!

<?
session_start();

echo "Welcome ". $_SESSION['first_name'] ." ". $_SESSION['last_name'] ."! You have made it to the members area!<br /><br />";

echo "Your are able to access the following areas: <br /><br />";

if($_SESSION['user_level'] == 0){
echo "<br /><a href=http://mysite.org>CLICK HERE</a>";
}
if($_SESSION['user_level'] == 1){
echo "<br /><a href=http://mysite.org/level1/index.html>ENTER MEMBERS AREA</a>";
}
if($_SESSION['user_level'] == 2){
echo "<br /><a href=http://mysite.org/level2/index.html>ENTER MEMBERS AREA</a>";
}
if($_SESSION['user_level'] == 3){
echo "<br /><a href=http://mysite.org/level3/index.html>ENTER MEMBERS AREA</a>";
}

echo "<br /><br /><br /><a href=logout.php>Logout</a>";

?>

Timotheos

4:24 pm on Mar 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



user_level says 2 in the database

I'm assuming that you've grabbed the user level out of the database at some other point and put it into your session variable?

andrewB

4:25 pm on Mar 4, 2004 (gmt 0)

10+ Year Member



Why don't you echo $_SESSION['user_level'] and see what that says?

oceanwave

7:18 pm on Mar 4, 2004 (gmt 0)

10+ Year Member



You both are right. My user_level was not being passed into my session variable. I've been trying to adapt a tutorial script. This is my first php site, so the obvious is not always obvious to me.

The page where the variables were defined registered user_level to special_user. When I changed the name special_user to user_level, the variable was passed.

Thanks so much!