Multi-Value Checkboxes
2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 18, 2010 (RSS)
By Kenny - June 18, 2010
It escapes me right now, but I have forgotten how to display items from a multi-value checkbox correctly;
Let's say someone checks of from the list of items like this:
[x] yellow
[x] red
[ ] blue
[ ] green
And if you were to put <?php echo $record['color'] ?>, it would display the results like this:
yellow red
What I want is to display them like this:
yellow, red
Help?
Let's say someone checks of from the list of items like this:
[x] yellow
[x] red
[ ] blue
[ ] green
And if you were to put <?php echo $record['color'] ?>, it would display the results like this:
yellow red
What I want is to display them like this:
yellow, red
Help?
Re: [sagentic] Multi-Value Checkboxes
By Chris - June 18, 2010
Hi sagentic,
I would do this using getListValues():
If you ever end up needing to use labels instead of values, you can swap in getListLabels().
I hope this helps! Please let me know if you have any questions.
I would do this using getListValues():
<?php
$values = getListValues('tableName', 'color', $record['color']);
echo join(', ', $values);
?>
If you ever end up needing to use labels instead of values, you can swap in getListLabels().
I hope this helps! Please let me know if you have any questions.
All the best,
Chris
Chris