PHP spits actual HTML instead of image -
having small issue here cannot figure out have gone wrong. have following code should show image depending on condition instead shows html in browser
if ($this->id_status == 2) { $this->id_status = "<img src='../_lib/img/gray_dot.png' />"; } elseif ($this->id_status == 1) { $this->id_status = "<img src='../_lib/img/green_dot.png' />"; } elseif ($this->id_status == 3) { $this->id_status = "<img src='../_lib/img/orange_dot.png' />"; } can help?
try this:
<?php if ($this->id_status == 2) { ?> <img src='../_lib/img/gray_dot.png' /> <?php } elseif ($this->id_status == 1) { ?> <img src='../_lib/img/green_dot.png' /> <?php } elseif ($this->id_status == 3) { ?> <img src='../_lib/img/orange_dot.png' /> <?php } ?>
Comments
Post a Comment