hollylala Posted March 3, 2009 Share Posted March 3, 2009 It goes without saying, I'm new to php and need help. This is what I've got working: <div id="table3"> <a href="http://<?php echo $row_Master['website']; ?>" target="blank"><img src="assets/iconW.jpg" width="20" height="20" alt="website" class="icon"/></a> This shows a small icon which links to the url of the given record. I'd like the icon to show only if the record has a url....and not show if the website field is empty. big thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/147676-solved-if-not-empty-show-image-with-link/ Share on other sites More sharing options...
RussellReal Posted March 3, 2009 Share Posted March 3, 2009 <div id="table3"> <?php if (strlen($z = $row_Master['website'])) echo "<a href='http://{$z}' target='_blank'><img src='assets/iconW.jpg' width='20px' height='20px' alt='website' class='icon' /></a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/147676-solved-if-not-empty-show-image-with-link/#findComment-775188 Share on other sites More sharing options...
hollylala Posted March 3, 2009 Author Share Posted March 3, 2009 Marvelous! Thank you very much! It works like a charm except that it's not finding the image. I get an image placeholder which functions just as I hoped, but no image. Thanks for your time and talents! Quote Link to comment https://forums.phpfreaks.com/topic/147676-solved-if-not-empty-show-image-with-link/#findComment-775206 Share on other sites More sharing options...
hollylala Posted March 3, 2009 Author Share Posted March 3, 2009 My mistake.....I had a template open. It works dandy in the right folder. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/147676-solved-if-not-empty-show-image-with-link/#findComment-775209 Share on other sites More sharing options...
RussellReal Posted March 3, 2009 Share Posted March 3, 2009 anytime dude click 'solved' and don't be shy to add me to MSN if you need to ask any small "not worth posting" questions Quote Link to comment https://forums.phpfreaks.com/topic/147676-solved-if-not-empty-show-image-with-link/#findComment-775228 Share on other sites More sharing options...
hollylala Posted March 3, 2009 Author Share Posted March 3, 2009 will do! and I'll try to make sure you don't regret it! Quote Link to comment https://forums.phpfreaks.com/topic/147676-solved-if-not-empty-show-image-with-link/#findComment-775251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.