Q:

Displaying links based upon field value PHP

Below is code which displays links for logged in/registered users and non logged in users for a site I am working on. The users login to a table called 'users' and this retrieves their SESSION primary key (users_id) and displays the logged in links.
What I am trying to do is a script which changes the displayed links depending on which values are in a field called 'users_type' (also within the 'users' table).
The different 'user_types' are Sales, Admin, Service, Maintenance and Management. Below shows what happens if the 'user_type' is Sales. 
What I am after is a script which will change the "sales.php" link to "admin.php" if the person who logged in had 'Admin' as their 'user_type' (or "service.php" for 'Service' etc).
Any help or a point in the right direction would be greatly appreciated
    <?php # loginnav.php>
    if (isset($_SESSION['users_id']) AND
    (substr($_SERVER['PHP_SELF'], -10)
    != 'logout.php')) {
       echo '
                <ul id="navlist">
                <li><a href="welcome.php">Welcome</a></li>
                <li><a href="sales.php">SALES</a></li>
                <li><a href="logout.php">Log out</a></li>   
                </ul>  

    ';
    } else { // Not logged in.
       echo '   <ul id="navlist">
                <li><a href="login.php">Login</a></li>
                </ul> 
    ';
    }
    ?>

A:

Perhaps I've misunderstood what you've asked, but if I haven't, then you want to change the link form admin/sales.php when the user's role is 'Admin'. If that's the case, this code below should work:
$link = $_SESSION['role'] == 'Admin' : 'Admin' ? 'Sales';

echo '<li><a href="', lcfirst($link), '.php'">', $link ,'</a></li>';

EDIT
Based on your comment below, it sounds like the file name and user_type are always the same, therefore you can just do:
echo '<li><a href="', lcfirst($_SESSION['user_type']) ,'.php">', $_SESSION['user_type'] ,'</a></li>';

Which will result in file_name.php where file_name is the session's user_type, with the first letter to lowercase and .php added. This should work.

