Need help turning multi value checkbox list into an array

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

By ScottL - June 15, 2012

I have a multi value checkbox list to select colors in an editor (select_color) that is setup to Get options from database -tablename is (product_colors), and option value/labels are (title).

How can I convert this to an array so I can display "colors" individually as a radio button on the viewer page instead of a string? I've looked around and tried a few things, but no luck. Thanks.

Re: [ScottL] Need help turning multi value checkbox list into an array

By Jason - June 15, 2012

Hi,

getRecords will provide you an array of all the selected values that you can access using the :values pseudo field.

EXAMPLE:
<?php foreach ($record['select_color:values'] as $color): ?>
<input type = "radio" name = "select_color" value = "<?php echo $color;?>" /><?php echo $color;?><br/>
<?php endforeach ?>


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/