bob2006 Posted May 11, 2007 Share Posted May 11, 2007 the if statment in my code is not work and can one tell me why here is the code <?php include'db.php'; include'userinfo.php'; echo"<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'> <tr> <td width='20%'> <img border='0' src='http://www.citrushostingplus.com/images/images.jpg' width='108' height='107'></td> <td width='20%'>Citrus</td> <td width='20%'>Hosting</td> <td width='20%'>Plus</td> <td width='20%'> </td> </tr> <tr> <td width='20%'> if($_SESSION['username'] && $_SESSION['password']) { echo"Welcome $frist $last"; } </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> <tr> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> </table> "; ?> Thank you if you can help Link to comment https://forums.phpfreaks.com/topic/50967-if-statment-nnot-working-in-echo/ Share on other sites More sharing options...
micah1701 Posted May 11, 2007 Share Posted May 11, 2007 because you can't put php code in an echo. <?php echo"<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'> <tr> <td width='20%'> <img border='0' src='http://www.citrushostingplus.com/images/images.jpg' width='108' height='107'></td> <td width='20%'>Citrus</td> <td width='20%'>Hosting</td> <td width='20%'>Plus</td> <td width='20%'> </td> </tr> <tr> <td width='20%'>"; if($_SESSION['username'] && $_SESSION['password']) { echo"Welcome $frist $last"; } echo " </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr>"; ?> or better yet...why echo all the html code in first place? <?php include'db.php'; include'userinfo.php'; ?> <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'> <tr> <td width='20%'> <img border='0' src='http://www.citrushostingplus.com/images/images.jpg' width='108' height='107'></td> <td width='20%'>Citrus</td> <td width='20%'>Hosting</td> <td width='20%'>Plus</td> <td width='20%'> </td> </tr> <tr> <td width='20%'> <?php if($_SESSION['username'] && $_SESSION['password']) { echo"Welcome $frist $last"; } ?> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> <td width='20%'> </td> </tr> Link to comment https://forums.phpfreaks.com/topic/50967-if-statment-nnot-working-in-echo/#findComment-250738 Share on other sites More sharing options...
Daniel0 Posted May 11, 2007 Share Posted May 11, 2007 The syntax highlighting should give you a clue to what is wrong. You forgot to close the string at the first echo. Link to comment https://forums.phpfreaks.com/topic/50967-if-statment-nnot-working-in-echo/#findComment-250739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.