Answer: use PEAR and Smarty (see http://smarty.incutio.com/?page=SmartestSmartyPractices for details on setting them up).
After you're setup according to the above article, here's the php:
<?
require_once 'set_env.php';
$res = $db->query("select somekey, somevalue from table");
while ($row = $res->fetchRow()) {
$options[$row['somekey']] = $row['somevalue'];
}
$t->assign('options', $options);
$t->display('page.tpl');
?>
and page.tpl will look similar to:
<html>
<body>
<form>
<select name="asdf">
{html_options options=$options}
</select>
</form>
</body>
</html>
(don't get me started on reinventing wheels)