Ok, I am working on the script below:
//GETS CURRENT ZID INSTRUCTORS
mysql_select_db("milfordl_joom3", $con) or die("Unable to select the database!");
//query to get controller's instructor
$queryi = "SELECT `INS` FROM `jos_roster` where `CID`='$lcid'";
$resulti = mysql_query($queryi, $con);
//start query to get complete list of instructors
$sql = "SELECT `FNAME`, `LNAME` FROM `jos_roster` WHERE `HARTCC`='ZID' && RATING LIKE 'Instructor %' ORDER BY LNAME";
$query = mysql_query($sql, $con) or die("There was an error with your Query: $sql. Error: " . mysql_error());
echo '<select name = "ins">';
while ($row = mysql_fetch_array($query))
{
$name = $row['FNAME'] . " " . $row['LNAME'];
if ($name == $resulti)
{
echo '<option selected="yes" value ="'. $name .'">' . $name . '</option>';
}
else
{
echo '<option value ="'. $name .'">' . $name . '</option>';
}
}
echo '</select><br>';
What I want it to do basically populate the drop down menu with everyone who has an instructor rating (Instructor (I1) or Instructor (I3)) which it does. What it dosen't do is I want it to compare the instructor they have in the database with the list of instructors and when they match have it selected automatically.