I am working on a dynamic drop down list that works in part. The piece that is not working and I can't see why is that it returns the same Name. The same name appears threes times which is how many entries are in in the database at this point. The name in the database are distinct. Thanks for any help you could give me!
This is my code:
<?php
$ID = odbc_result($result, 'ID');
$FName = odbc_result($result, 'FName');
$LName = odbc_result($result, 'LName');
$Title = odbc_result($result, 'Title');
$Phone = odbc_result($result, 'Phone');
$Room = odbc_result($result, 'Room');
$BldgID = odbc_result($result, 'BldgID');
$DeptID = odbc_result($result, 'DeptID');
echo" <SELECT name=\"ID\">";
echo" <OPTION value=\"\">--Select One--</OPTION>";
WHILE(odbc_fetch_row($result)) {
if($ID=='ID') {
echo "<OPTION value= \"ID\" SELECTED>$LName, $FName</OPTION>";
} else {
echo "<OPTION value= \"ID\">$LName, $FName</OPTION>";
}
}
echo"</SELECT>";
?>