I have a drop down menu that I am dynamically populating based on values in a database table. The code looks something like this:
<select>
<option value="" selected="selected">Select Option</option>
<?php foreach($var as $row): ?>
<option value="<?php echo $row->value;?>"><?php echo $row->value;?></option>
<?php endforeach;?>
</select>
This works fine and creates a default option called 'Select Option' at the top of the list. But I also have another variable that I am passing to this view that specifies a custom default option. So rather than having 'Select Option' as the default selected option, it would be one of the dynamically printed values in the middle of the list? Any ideas on how to do this (no javascript)?