I want to be able to do two things. The first, is look at all "selected" items of a certain value. Say I have a, b, c ; I want to look for all items selected as "c" and highlight that table row as a different color. In addition, upon opening the form, I want the items counted, and be able to display a message div at the top of the screen showing those highlighted items. What is the best practical way of doing this? This is my original code :
//Start loop of items
<?php foreach ( $data['Detail'] as $key=>$item){?>
<tr id="tr_<?php echo $key+1?>">
<td>
<select value="<?php echo $location; ?>" name="[<?php echo $key;?>][location]" id="location_<?php echo $key+1?>" class="form-control>
<option value="Selection1" <?= ($item['location']) == 'Selection1' ? 'selected' : '' ?>>Selection1</option>
<option value="Selection2" <?= ($item['location']) == 'Selection2' ? 'selected' : '' ?>>Selection2</option>
<option value="Selection3" <?= ($item['location']) == 'Selection3' ? 'selected' : '' ?>>Selection3</option>
</select>
</td>
</tr>
// Segment here to count? Example :
// $location_count = 0; If $location = 'c' then $location_count++;
<?php } ?>
Sample Div Code :
<div>
<p>You have <?php echo $location_count?> Locations that need reviewed</p>
</div>
