      <?
      echo "<option value='' selected>--Select Department--</option>";
      $mydeptquery="Select * from staff_departments where dept_divpkey='".$objdivpkey."' order by dept_name"; 
      $mydeptresult =& $db->query($mydeptquery);
      $mydeptcount=$mydeptresult->numRows();
      if ($mydeptcount!=0) {
        while($mydeptrow=$mydeptresult->fetchRow()) {
          echo "<option value='".$mydeptrow['dept_pkey']."' ";
          if ($mydeptrow['dept_pkey']==$objdeptpkey) { echo "selected"; }
          echo ">";
          echo $mydeptrow['dept_name'];
          echo "</option>";
        }
      }
      ?>
