I have seen one answer to this, but I didn't understand something - what goes where the question marks are (on the 6th line)?. Looked around for a while, but someone probably has the answer on the tip of their tongue. - (Yes, I know I'm mixing escape characters in my code, but I'm in the beginning of trying to create cleaner/better code, and I probably shouldn't mix PHP and HTML)
<select name="teacher"> ';
$empquery = "SELECT * FROM `employees` ORDER BY `lastname`";
$empresults = $pdo->query($empquery);
while ($emprow = $empresults->fetch()) {
echo "<option value=".$emprow['id'];
if (?????????? == $emprow['id'])
echo "selected = 'selected'";
echo "> {$emprow['lastname']} {$emprow['firstname']}</option> ";
}
echo ' </select>