Populate drop down from List Field
5 posts by 4 authors in: Forums > CMS Builder
Last Post: April 5, 2010 (RSS)
Hi,
I have a list field for a section containing t-shirt sizes. (mutli-selection check boxes)
<?php echo join(',', getListLabels('merchandise', 'size', $merchandiseRecord['size'])); ?>
But instead of displaying the sizes( ex. S, M, L, XL ...like the above code will do)
I want them to be in a drop down list for people to select what size they want..
I know this isnt right, but something like this (this only displays the first size:
select name="Size">
<option value="Small"><?php echo join('</option>', getListLabels('merchandise', 'size', $merchandiseRecord['size'])); ?>
</select>
I have a list field for a section containing t-shirt sizes. (mutli-selection check boxes)
<?php echo join(',', getListLabels('merchandise', 'size', $merchandiseRecord['size'])); ?>
But instead of displaying the sizes( ex. S, M, L, XL ...like the above code will do)
I want them to be in a drop down list for people to select what size they want..
I know this isnt right, but something like this (this only displays the first size:
select name="Size">
<option value="Small"><?php echo join('</option>', getListLabels('merchandise', 'size', $merchandiseRecord['size'])); ?>
</select>
Re: [s2smedia] Populate drop down from List Field
By Chris - February 18, 2010 - edited: February 18, 2010
Hi s2smedia,
How about this?
I hope this helps! Please let me know if you have any questions.
How about this?
<select name="Size">
<?php $options = getListLabels('merchandise', 'size', $merchandiseRecord['size']) ?>
<?php foreach($options as $option): ?>
<option><?php echo htmlspecialchars($option) ?></option>
<?php endforeach ?>
</select>
I hope this helps! Please let me know if you have any questions.
All the best,
Chris
Chris
Re: [chris] Populate drop down from List Field
By thenetgirl - April 2, 2010
is there anything you have to put in the page header for this to work????
Patricia
www.thenetgirl.com
www.thenetgirl.com
Re: [thenetgirl] Populate drop down from List Field
By Donna - April 5, 2010
Hi Patricia!
Nothing specific, but this particular code will only work in a repeating foreach loop (as in a list of items), as opposed to on its own like what you're trying to do. :)
Nothing specific, but this particular code will only work in a repeating foreach loop (as in a list of items), as opposed to on its own like what you're trying to do. :)
Donna
--
support@interactivetools.com
--
support@interactivetools.com