Jump to content

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

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.