Forget what I put in that last post, it was messy, here is an edited version with the pg query functions in it aswell :
print "<form><select size=1 name='foobar_select'>";
print "<option selected value='nonsel'>-- None Selected --</option>";
$db_query = "SELECT foo_id, foo FROM bar ORDER BY foo";
$db_query_exec = pg_exec($db_query);
$numrows = pg_numrows($db_query_exec);
for ($i=0; $i<$numrows; $i++)
{
$foobar = mysql_fetch_row($db_query_exec);
print "<option value='".$foobar[0]."'>".$foobar[1]."</option>";
}
print "</select>";
print "</form>";