Generating a Single Bullet List from multiple drop down lists
3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 20, 2016 (RSS)
By csdesign - January 19, 2016
Hello! I'm not sure if this is possible or not and so far everything I've tried is NOT working.
What I have is a list of "horse qualities" on a detail page. Each quality has an option of three levels (Finished, Started or Prospect)
Right now each quality has it's own field with the same three level pull down list. If the level is "none" then "select" works just fine for it not to display.
However, I would like all of the horse qualities that have been given a level to show up in a bulleted list and this is where I ran into problems.
How do I get the bulleted list to not display horse qualities if the level is "none" aka "select".
I have included screenshots of exactly what I have at this point. It's displaying exactly as I thought it would (bullets with nothing following them) but attempts to make it display correctly have failed. Because this is a detail page and it involves multiple fields I'm not sure how to handle it.
Thanks so much!! Tina
<ul>
<li><?php echo $add_sale_horseRecord['rope_heel'] ?></li>
<li><?php echo $add_sale_horseRecord['reining_horse'] ?></li>
<li><?php echo $add_sale_horseRecord['kid_horse'] ?></li>
<li><?php echo $add_sale_horseRecord['rope_calves'] ?></li>
<li><?php echo $add_sale_horseRecord['ranch_horse'] ?></li>
<li><?php echo $add_sale_horseRecord['barrel_horse'] ?></li>
<li><?php echo $add_sale_horseRecord['parade_horse'] ?></li>
<li><?php echo $add_sale_horseRecord['cutting'] ?></li>
<li><?php echo $add_sale_horseRecord['trail'] ?></li>
<li><?php echo $add_sale_horseRecord['mounted_shooting'] ?></li>
</ul>
By Damon - January 20, 2016
Hi Tina,
To not have the bullet appear if there is nothing selected, you need to wrap the <li> code with an IF statement. The IF statement will check to see if a variable (selection) exists and if it does, display the <li> code.
Right now you have this:
<li><?php echo $add_sale_horseRecord['rope_heel'] ?></li>
For each list item wrap in an IF statement like this:
<?php if($add_sale_horseRecord['rope_heel']) : ?>
<li><?php echo $add_sale_horseRecord['rope_heel'] ?></li>
<?php endif; ?>
Make sure you change the variable name inside the if statement to match each.
Let me know if you have any questions.
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/