I've got two tables (classOfferings, instructors). The fields I'm dealing with are 'co.instructorId', 'i.instructorId', 'i.fName', 'i.lName'.
I have a form with dynamically generated drop downs.
What I would like to do is check classOfferings table to see which instructors are teaching classes then display them in drop down with the 'instructorId' as the value and 'fName' and 'lName' as the user selectable part. So I have found the distinct 'instructorId', but I can't make 'fName' and 'lName' appear as the user selectable part.
The code below produces a drop down which has invisible values, but still posts a value.
<select size="1" name="instructor">
<option value="" selected>Search By Teacher...</option>
<?
$instrList=mysql_query("select distinct instructorId from classOfferings order by instructorId asc");
$instrNameList=mysql_query("select fName, lName from instructors where classOfferings.instructorId = instructors.instructorId order by lName asc");
// Show records by while loop.
while($instructor_list=mysql_fetch_assoc($instrList)){
$instrNames = ($instr_Name['fName']) . ($instr_Name['lName']);
?>
<option value="<? echo $instructor_list['instructorId']; ?>" <? if($instructor_list['instructorId']==$select){ echo "selected"; } ?>>
<? echo $instrNames; ?></option>
<?
// End while loop.
}
?>
</select>