IF statement inside echo
Posted: Mon Oct 12, 2009 3:36 pm
Hi guys
As my name suggests, i'm new to php so please go easy on me.
I'm trying to output (unsuccessfully thus far) the following inside an echo:
Here's the same php code outside the
As my name suggests, i'm new to php so please go easy on me.
I'm trying to output (unsuccessfully thus far) the following inside an echo:
Code: Select all
echo '
<li><a href="prices.php" class="topnav1">Prices</a></li>
<li><a href="order.php" class="prinav">Place an order</a></li>
<li class="linav"><?php if ( (isset($_SESSION[\'user_id\'])) && (!strpos($_SERVER[\'PHP_SELF\'], \'sign_out.php\')) ) {
echo \'<a href="sign_out.php">Sign out</a>\';}
else {
echo \'<a href="sign_in.php">Sign in</a>\';
}
?></li>';
Code: Select all
bubble:
echo '
<li><a href="prices.php" class="topnav1">Prices</a></li>
<li><a href="order.php" class="prinav">Place an order</a></li>
<li class="linav"><?php if ( (isset($_SESSION[\'user_id\'])) && (!strpos($_SERVER[\'PHP_SELF\'], \'sign_out.php\')) ) {
echo \'<a href="sign_out.php">Sign out</a>\';}
else {
echo \'<a href="sign_in.php">Sign in</a>\';
}
?></li>';
I've googled for solutions but nothing seems to work. Help greatly appreciated....thanks
PHPnoobyyy