Jump to content

Recommended Posts

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

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.