-2

I tried to generate a html table with only 2 cells using PHP. First table cell is an image and second cell has another table. I can put the data which I want in second cell (in table format). But failed to display image in first table cell.

Searching the forum showed some solved echo related to issue, but it couldn’t solve my problem.

Here is the code I used,

if(array_filter($values2))
{

     echo "<!DOCTYPE html>";
     echo "<html>";
     echo "<head>";
     echo "<table>";

     echo "<tr>";
     echo "<td>";
     echo "<img src = treedir . '/' .  $tffam;?>"; //my problem here
     echo "</td>";              

     echo "<td>";
     //a table generating code and it  works fine
     echo "</td>";
     echo "</tr>";
     echo "</body>";
     echo "</html>"; 

}
Adrian Cid Almaguer
  • 9,598
  • 13
  • 48
  • 65
svp
  • 725
  • 6
  • 17
  • possible duplicate of [How to combine two strings together?](http://stackoverflow.com/questions/8336858/how-to-combine-two-strings-together) – Rizier123 Feb 24 '15 at 06:00

2 Answers2

1

The problem was with the " and the '. Try with this:

  echo "<img src='/treedir/" .  $tffam . "'/>";
Adrian Cid Almaguer
  • 9,598
  • 13
  • 48
  • 65
1

you can try this :

echo "<img src='treedir/$tffam' alt='some text' >";