Jump to content

Archived

This topic is now archived and is closed to further replies.

AdRock

How to display a hyperlink depending on session value [RESOLVED]

Recommended Posts

I am trying to display a hyperlink on if the $_SESSION['user_level'] is 3

If the user is logged in and the session not started the link doesn't appear.  Also if the user level is 0, 1, 2 the link doesn't appear

I tried using something like i used in the my login
[code]<?
if(isset($_SESSION["username"])) {
    echo "<a class='one' href='/logout'>Logout</a>";
} else {
    echo "<a class='one' href='/login'>Login</a>";
}
?>[/code]

I tried using [b]if(isset($_SESSION["username"]=3))[/b] but it threw up an error

Share this post


Link to post
Share on other sites
try this
[code=php:0]
if ($_SESSION['userlevel'] == 3) {
   echo '<a href="somepage.php">Userlevel 3</a>';
}
[/code]

hope this helps

Share this post


Link to post
Share on other sites
[code=php:0]if($_SESSION["username"]==3)
{
echo("link");
}[/code]
[hr]

Orio.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.