jamescool
04-23-2012, 05:24 AM
Hi friends I cannot understand why we need the close curly braces in opening and closing php tags.
kindly have the code below as the referrence:
im trying to implement this with a login script where user can be a guest,ordinary member and an admin...
<?php
include "dbc.php";
if (isset($_SESSION['user_id'])) {?>
<span class="style2"><a href="mysettings.php">Edit Profile</a> | <a href="logout.php">Logout </a></span>
<?php
if (checkAdmin()) { ?>
| <span class="style2"><a href="admin.php">Control Panel</a></span>
<?php
}
} else {
?>
<span class="style2"><a href="login.php">Login</a></span>
<?php
}
?>
so that if user is admin, Control Panel will be before edit Profile and Logout...
the visual thing is like the links below..
if admin:
Control Panel | Edit Profile | Logout
if not admin:
| Edit Profile | Logout
the implementation should be easy and the logic is very simple...im just having a problem with the php syntax...can u explain a little about the php tags...closed after curly braces etc..THanks Much!
kindly have the code below as the referrence:
im trying to implement this with a login script where user can be a guest,ordinary member and an admin...
<?php
include "dbc.php";
if (isset($_SESSION['user_id'])) {?>
<span class="style2"><a href="mysettings.php">Edit Profile</a> | <a href="logout.php">Logout </a></span>
<?php
if (checkAdmin()) { ?>
| <span class="style2"><a href="admin.php">Control Panel</a></span>
<?php
}
} else {
?>
<span class="style2"><a href="login.php">Login</a></span>
<?php
}
?>
so that if user is admin, Control Panel will be before edit Profile and Logout...
the visual thing is like the links below..
if admin:
Control Panel | Edit Profile | Logout
if not admin:
| Edit Profile | Logout
the implementation should be easy and the logic is very simple...im just having a problem with the php syntax...can u explain a little about the php tags...closed after curly braces etc..THanks Much!