I'm not a postgresSQL user but, what i can see in your code is that
for ($j=0; $j < $rows2; $j++) {
$pos23 = pg_result($result_set, $j, "department");
echo "<select size=1 name=department><option>$pos23</option></select>";
}
This will output,
<SELECT><option>posX/option></SELECT>
..
...
<SELECT><option>posN</option></SELECT>
it will then be rendered as separate select object in ur browser.. each select object contains only 1 select option. ? maybe you should do this one..
$select = "<select name = department>";
for ($j=0; $j < $rows2; $j++) {
$pos23 = pg_result($result_set, $j, "department");
$select .= "<select size=1 name=department><option>$pos23</option></select>";
} //for
$select .= "</SELECT>";
echo $select;
jun