Jump to content

Why does this "else" give an error?


Fenhopi

Recommended Posts

Here's my code:

 </head>

  
<body bgcolor="Silver">



<table>

<tr><td>


<?
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
   echo "<ul><h1>Logged In</h1>";
   echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
?>
       <li><p class="normal">[<a href=\"userinfo.php?user=$session->username\">My Account</a>]   </a></li></p>"
       <li>[<a href=\"useredit.php\">Edit Account</a>]   </li>";
<?       
   if($session->isAdmin()){
?>
<li>[<a href=\"admin/admin.php\">Admin Center</a>] </li>"
   
   	<li>[<a href=\"process.php\">Logout</a>]</li></ul>"

<?
else:
?>

 

The else function on the end is followed by the code I have for the login.

If I remove the else function, just to try and run the code I get an error on a line number that doesn't exist. Please help.

 

Link to comment
https://forums.phpfreaks.com/topic/195946-why-does-this-else-give-an-error/
Share on other sites

</head>

  
<body bgcolor="Silver">



<table>

<tr><td>


<?
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
   echo "<ul><h1>Logged In</h1>";
   echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
?>
       <li><p class="normal">[<a href=\"userinfo.php?user=$session->username\">My Account</a>]   </a></li></p>"
       <li>[<a href=\"useredit.php\">Edit Account</a>]   </li>";
<?       
   if($session->isAdmin()){
?>
<li>[<a href=\"admin/admin.php\">Admin Center</a>] </li>"
   
   	<li>[<a href=\"process.php\">Logout</a>]</li></ul>"

<?}?>

 

Try that

Archived

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

×
×
  • Create New...

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.