jseth
03-25-2009, 08:07 PM
I have a drop down list filling itself from my database. All of the items (names, actually) show up nicely, however I want the first item to be Choose..., or Select..., not the first item/name on the list. When I try to enter <option value="0">Choose... anywhere in the code, with or without the end tag </option>, the word Choose... appears above EVERY item/name in the list! I know how to do this with a manual list, but not with one drawing from a database. Does anyone out there know how to do this?
Here's the code:
<label><b>Select Counselor: </b></label><select name="counselor" size="1">
<?php
do {
?>
<option value="<?php echo $row_counselor['name']?>"<?php if (!(strcmp($row_counselor['name'], $row_counselor['name'])))?>><?php echo $row_counselor['name'];?></option>
<?php
} while ($row_counselor = mysql_fetch_assoc($counselor));
$rows = mysql_num_rows($counselor);
if($rows > 0) {
mysql_data_seek($counselor, 0);
$row_counselor = mysql_fetch_assoc($counselor);
}
?>
</select>
Thanks.
Here's the code:
<label><b>Select Counselor: </b></label><select name="counselor" size="1">
<?php
do {
?>
<option value="<?php echo $row_counselor['name']?>"<?php if (!(strcmp($row_counselor['name'], $row_counselor['name'])))?>><?php echo $row_counselor['name'];?></option>
<?php
} while ($row_counselor = mysql_fetch_assoc($counselor));
$rows = mysql_num_rows($counselor);
if($rows > 0) {
mysql_data_seek($counselor, 0);
$row_counselor = mysql_fetch_assoc($counselor);
}
?>
</select>
Thanks.