Thread: else statements
View Single Post
Old 07-15-2010, 02:55 PM   #1 (permalink)
Tim Dobson
The Contributor
 
Tim Dobson's Avatar
 
Join Date: Feb 2010
Posts: 69
Thanks: 16
Tim Dobson is on a distinguished road
Default else statements

Im having a bit of trouble figuring the else statements out. I got a login for the site but i cant get it to display logout instead of login if the user is logged in.

Here is what i got:

PHP Code:
<?php
//Start session
session_start();
//Check whether the session variable
//SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_MEMBER_ID']) || 
    (
trim($_SESSION['SESS_MEMBER_ID'])=='')) {
    echo 
"<a href='http://www.sb0t.tentun.co.uk/Login/login-form.php'>Click here</a> to login to your account.<br><a href='http://www.sb0t.tentun.co.uk/Login/register-form.php'>Click here</a> to create an account.'
    
} else {
echo '<a href='http://www.sb0t.tentun.co.uk/Login/logout.php'>Click here</a> to logout.'
}
?>

Where am i goin wrong ? :(
Tim Dobson is offline  
Reply With Quote