If Selected then Show Image
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 13, 2009 (RSS)
By jposwald - March 12, 2009
Dave,
I need to set up a Promotion advise to the products list.
So i've added a list field called "Promotion" with 2 options to select from: Yes or No.
If product is under Promotion, I'll select "Yes" and then I want to show it in the webpage with an Image, and if not under promotion, i do not want any image to display.
How can I do it with the php if function?
Thank you, Juan.
I need to set up a Promotion advise to the products list.
So i've added a list field called "Promotion" with 2 options to select from: Yes or No.
If product is under Promotion, I'll select "Yes" and then I want to show it in the webpage with an Image, and if not under promotion, i do not want any image to display.
How can I do it with the php if function?
Thank you, Juan.
Re: [jposwald] If Selected then Show Image
By Dave - March 13, 2009
Hi Juan,
First, display the value of the promotion field, I'll pretend it's called 'promotion' but your field might be called something else (and they are CaSe SeNsItIvE, so case matters).
'<?php echo $record['promotion']; ?>'
Say that displays 'Yes', copy that exact value into this code:
Hope that helps! Let me know how that works for you.
First, display the value of the promotion field, I'll pretend it's called 'promotion' but your field might be called something else (and they are CaSe SeNsItIvE, so case matters).
'<?php echo $record['promotion']; ?>'
Say that displays 'Yes', copy that exact value into this code:
<?php if ($record['promotion'] == 'Yes'): ?>
... html you want to display here ...
<?php endif ?>
Hope that helps! Let me know how that works for you.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com