"IF condition" is this possible?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 16, 2012   (RSS)

By videopixel - July 15, 2012 - edited: July 15, 2012

Could i call a field from a record into an if condition?

<?PHP if ($record['sample'] == "book"): ?>

I want to replace "book" with

<?PHP if ($record['sample'] == "<?php echo $myRecord['category'] ?>"): ?>

What is the correct way to do this?


thx

Re: [videopixel] "IF condition" is this possible?

By Jason - July 16, 2012

Hi,

You have the right idea, but you don't need the extra <?php ?> tags, since you are already inside a PHP block.

Try this:

<?PHP if ($record['sample'] == $myRecord['category']): ?>

This will compare $record['sample'] to $myRecord['category']

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/