different images when field are empty/value

5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 2, 2009   (RSS)

Re: [efi-revivo] different images when field are empty/value

By Dave - February 2, 2009

Hi efi-revivo,

Try this:

<script type="text/javascript">
<?php if ($record['web_site']): ?>
document.write('<a href="http://<?php echo $record['web_site'] ?>"><img src="imagesnew/yes.jpg" title="Web-site" width="26" height="26" border="0" /></a>');
<?php endif ?>
</script>


or another way:

<?php if ($record['web_site']): ?>
<script type="text/javascript">
document.write('<a href="http://<?php echo $record['web_site'] ?>"><img src="imagesnew/yes.jpg" title="Web-site" width="26" height="26" border="0" /></a>');
</script>
<?php endif ?>


Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] different images when field are empty/value

thanks dave it's ok but I want to see the no.jpg image when the field is empty.

Re: [efi-revivo] different images when field are empty/value

By Dave - February 2, 2009

Ok, do you need javascript at all? How about this:

<?php if ($record['web_site']): ?>
<a href="http://<?php echo $record['web_site'] ?>"><img src="imagesnew/yes.jpg" title="Web-site" width="26" height="26" border="0" /></a>
<?php else: ?>
<img src="no.jpg" />
<?php endif ?>
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] different images when field are empty/value

Thanks dave it's work now like i want :-)