Jump to content

Can't echo an image


sunnysideup

Recommended Posts

I'm having issues echoing image in the below code:

<?php echo "<span style=\"";
   # If we gained print the percentage in GREEN
   if ($data[1]>0) {
      echo "color: #009900;";
      echo "<img src='images/up.png'>";
    } # if we lost RED
   elseif ($data[1]<0) {
      echo "color: #DF0D0D;";
      echo "<img src='images/down.png'>";
    } # No color
   else {
      echo "font-weight: normal;";
    }
   echo "\">".$data[0]."</span></li>\n";
?>

 

Can someone please tell me, where i'm going wrong?

Link to comment
https://forums.phpfreaks.com/topic/199506-cant-echo-an-image/
Share on other sites

The Page source is as follows:

    <table border="0" width="750" id="table2" cellspacing="0" cellpadding="0">
	<tr>
		<td width="80"><font size="2">Sensex</font></td>
		<td><font face="Tahoma" size="2">
					<span style="color: #009900;<img src= '../images/up.png'>">17694.2</span></li>
</font></td>
	</tr>
</table>

Link to comment
https://forums.phpfreaks.com/topic/199506-cant-echo-an-image/#findComment-1047108
Share on other sites

Need more coffee, but...

(or at least you can see what I mean)

 

if ($data[1]>0) {
?>
<span style="color: #009900;"><img src="../images/up.png"><?PHP echo $data[0]; ?></span>
<?PHP
}
if ($data[1]<0) {
?>
<span style="color: #DF0D0D;"><img src="../images/down.png"><?PHP echo $data[0]; ?></span>
<?PHP
}
if($data[1] == 0) {
?>
<span style="font-weight: normal;"><img src="../images/down.png"><?PHP echo $data[0]; ?></span>
<?PHP
}

Link to comment
https://forums.phpfreaks.com/topic/199506-cant-echo-an-image/#findComment-1047140
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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