      <?
      include_once('dbincludes.php');
      $mydeptlist="";
      $mydeptlist="|--Select Department--";
      $mydivpkey=$_REQUEST['itemid'];
      $mydeptquery="Select * from staff_departments where dept_divpkey='".$mydivpkey."' order by dept_name"; 
      $mydeptresult =& $db->query($mydeptquery);
      $mydeptcount=$mydeptresult->numRows();
      if ($mydeptcount!=0) {
        while($mydeptrow=$mydeptresult->fetchRow()) {
          $mydeptlist=$mydeptlist."~".$mydeptrow['dept_pkey']."|".$mydeptrow['dept_name'];
        }
        //$mydeptlist=substr($mydeptlist,1);
      }
      print $mydeptlist;
      ?>
