frank_solo Posted March 21, 2012 Share Posted March 21, 2012 I have a form where it will display the image that was uploaded but if there is no image uploaded I would like it to say "No Image" I have this <img src="../<? echo $rows['imageurl6']; if(!empty($rows)){echo 'No Image';}?>" width="200" /> but it doesn't work. Can someone help me please? Thanks Link to comment https://forums.phpfreaks.com/topic/259437-no-image-statement/ Share on other sites More sharing options...
Mahngiel Posted March 21, 2012 Share Posted March 21, 2012 You don't want to do your conditional inside the img tag's src attribute, as if the conditional is false, you'll have a jacked up tag. Instead, output only if the condition is true. <?php if(isset($rows)) { echo '<img src="$rows['imageurl]" width="200" />'; } ?> Link to comment https://forums.phpfreaks.com/topic/259437-no-image-statement/#findComment-1329924 Share on other sites More sharing options...
frank_solo Posted March 21, 2012 Author Share Posted March 21, 2012 Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/259437-no-image-statement/#findComment-1329966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.