Conditionally inserting HTML lines? Beating head against ||
Posted: Mon May 17, 2004 6:27 am
Hi,
I'm trying to figure out how to use PHP to conditionally determine which of two lines of HTML get used.
I thought I had the logic down, but the parser sputters and fails with my code. What I'm attempting is this: If a user is logged on, then the logout button with the appropriate variables is displayed. Otherwise, the login button is displayed instead.
When I look at it, it's obvious from the code coloring that something is definately not right here. I have tried echo. printf, add/stripslashes and now htmlspecialcharacters.
Could someone point me in the right direction to learn how to fix this?
Thank you,
SteedVLX
I'm trying to figure out how to use PHP to conditionally determine which of two lines of HTML get used.
I thought I had the logic down, but the parser sputters and fails with my code. What I'm attempting is this: If a user is logged on, then the logout button with the appropriate variables is displayed. Otherwise, the login button is displayed instead.
Code: Select all
<?php
<?php
if($display_logout_btn ='FALSE')
{
$line_output = htmlspecialcharacters('<a href="../forums/login.php" onMouseDown="MM_swapImage('btn_login','','../images/btn_login_down.gif',1)" onMouseUp="MM_swapImage('btn_login','','../images/btn_login_over.gif',1)" onMouseOver="MM_swapImage('btn_login','','../images/btn_login_over.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="../images/btn_login.gif" alt="Proceed to the login page" name="btn_login" width="66" height="21" border="0"></a>');
}
else
{
$line_output = htmlspecialcharacters('<a href="../forums/login.php?logout=true" onMouseDown="MM_swapImage('btn_logout','','../images/btn_logout_down.gif',1)" onMouseUp="MM_swapImage('btn_logout','','../images/btn_logout_over.gif',1)" onMouseOver="MM_swapImage('btn_logout','','../images/btn_logout_over.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="../images/btn_logout.gif" alt="End Session" name="btn_logout" width="66" height="21" border="0"></a>');
}
echo ('$line_output');
?>
?>Could someone point me in the right direction to learn how to fix this?
Thank you,
SteedVLX