Forum Moderators: coopster
<!-- ADDING -->
<select id='type'>
<option value='r' SELECTED>Restaurant/Bar</option>
<option value='s'>Store/Retailer</option>
<option value='d'>Distributor</option>
</select>
I found this example code, but I can't seem to figure out why it is not working for me:
<!-- UPDATING -->
<?php
while ($row = mysql_fetch_assoc($result))
{
echo '<select name="type" id="type">';
echo '<option'.($row['type']=="r"? ' selected' : '').'>Restaurant/Bar</option>';
echo '<option'.($row['type']=="s"? ' selected' : '').'>Store/Retailer</option>';
echo '<option'.($row['type']=="d"? ' selected' : '').'>Distributor</option>';
echo '</select>';
}
?>
Thank you in advance from a newb who is trying to learn.
Brian
<?php
echo '<select name="type" id="type">';
echo '<option value="r"'.($row['type']=="r"? ' selected' : '').'>Restaurant/Bar</option>';
echo '<option value="s"'.($row['type']=="s"? ' selected' : '').'>Store/Retailer</option>';
echo '<option value="d"'.($row['type']=="d"? ' selected' : '').'>Distributor</option>';
echo '</select>';
?>