<?php
	include('/var/www/html/uclit/protected/common/login/check.php');
	include('/var/www/html/uclit/protected/common/css_login/css_head2.php');
	include('/var/www/html/uclit/protected/connections/db_equip.php');
    	
	
	$sql = "SELECT DISTINCT dept_id, dept_name FROM departments ORDER BY dept_name";
	$db = mysql_select_db('equipment', $equipConn) or die ("Unable to select equipment database.");
	$sql_result = mysql_query($sql, $equipConn) or die ("Unable to query the following SQL statement:<p>$sql</p>");

	if (!$sql_result) 
	{
		echo "<p>couldn't get list! $sql_result</p>";
	}
	else
	{
?>
	<h2>Select Equipment by Department</h2>
	<form method='post' action='/uclit/protected/itstaff/process_equipbydept.php'>
  	<table CELLSPACING='3' CELLPADDING='3'>
    <tr>
      <td height='125' VALIGN=TOP><P><STRONG>Department:</STRONG><BR />
          <select name='staff_dept'>
            <option selected value=''>Select.......</option>
<?php
				while ($row = mysql_fetch_array($sql_result)) 
				{
					$deptid = $row['dept_id'];
					$deptname = $row['dept_name'];
					echo "<option value='$deptid'>$deptname - $deptid</option>";
				}
?>
          </select>
        <P>
	          <INPUT TYPE='SUBMIT' NAME='submit' VALUE='Submit Department'>
        </P></td>
    </tr>
  </table>
</form>
<?php
	}
	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php'); 
?>