Multiple Check box list

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 23, 2009   (RSS)

By MRI - November 19, 2009

See below: 'category' is the name of my multiple checkbox list
Simulcast Racing is one of the list items. so in the code below, it will only display Promotions that have Simulcast selected.

My problem is, I need to select 2 options for a promotion. So for below I want it to display promotions with Simulcast Racing and Live Racing selected. how do I do this?

<?php foreach ($promotions_managerRecords as $record): ?>
<?php if (strpos($record['category'], 'Simulcast Racing')): ?>
<li><a href="../rewards/promotions.php#<?php echo $record['num'] ?>"><?php echo $record['title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>

Re: [MRI] Multiple Check box list

By Chris - November 20, 2009

Hi MRI,

You can either add a second IF block, or an OR clause to the condition, as I've added below in red:

<?php foreach ($promotions_managerRecords as $record): ?>
<?php if (strpos($record['category'], 'Simulcast Racing') || strpos($record['category'], 'Live Racing')): ?>
<li><a href="../rewards/promotions.php#<?php echo $record['num'] ?>"><?php echo $record['title'] ?></a></li>
<?php endif ?>
<?php endforeach; ?>


I hope this helps! Please let me know if you have any questions.
All the best,
Chris