<?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_pers.php');

	$today="";
	$idnum = $_GET['idnum'];
	$query= "SELECT personnel.personnel_id, personnel.last_name, personnel.first_name, personnel.middle_name, personnel.dept_id, personnel.room, personnel.e_mail, personnel.phone, personnel.web_role, personnel.room, personnel.duties, personnel.duties_sec, personnel.removed,personnel.type_id, personnel.title, personnel.working_title, personnel.ID_Num, departments.dept_id,departments.mail_location, departments.dept_name, departments.building, departments.faxnum, departments.dept_head_id FROM departments INNER JOIN personnel ON (departments.dept_id = personnel.dept_id)WHERE personnel.personnel_id='$idnum'" ; 
        
        $db = @mysql_select_db($database_uclit_db, $uclit_dbConn)
		or die("Couldn't select database.");
	$result = @mysql_query($query,$uclit_dbConn)
		or die("Couldn't execute query.");
        $row = mysql_fetch_array($result);
	$lname=$row['last_name'];
	$fname = $row['first_name'];
        $mname = $row['middle_name'];
	$deptname = $row['dept_name'];
        $deptid = $row['dept_id'];
	$bldg = $row['building'];
	$rmnum = $row['room'];
	$mloc = $row['mail_location'];
	$phonenum = $row['phone'];
	$faxnum = $row['faxnum'];
	$email = $row['e_mail'];
	$project = $row['duties'];
        $secondary = $row['duties_sec'];
	$title = $row['title'];
	$working = $row['working_title'];
	$ucid = $row['ID_Num'];
	$type_id = $row['type_id'];
		
	$query2= "SELECT DISTINCT dept_name FROM departments ORDER BY dept_name" ;	
	$result2 = @mysql_query($query2,$uclit_dbConn)
		or die("Couldn't execute query2.");
	
echo "

<Form method=\"POST\" action=\"update_staff.php\">
  <h1 align=\"center\">University Libraries Staff Information</h1>
  <p>&nbsp;</p>
  <input type=\"hidden\" name=\"ID\" value=\"$idnum\" size=30>
  <table width=\"80%\" border=\"1\">
    <tr>
      <td><font color=\"#0000CD\"> Last Name: </font><input type=\"text\" name=\"lnametext\" value=\"$lname\" size=30 ></td>
	  <td><font color=\"#0000CD\"> First Name: </font><input type=\"text\" name=\"fnametext\" value=\"$fname\" size=30 > </td>
    </tr>
	<tr>
      <td><font color=\"#0000CD\">Building: </font> <input type=\"text\" name=\"bldgtext\" value=\"$bldg\" size=30></td> 
      <td><font color=\"#0000CD\">Phone Number: </font><input type=\"text\" name=\"phonetext\" value=\"$phonenum\" size=20></td> 
       </tr> 
	<tr>
	  <td><font color=\"#0000CD\">Room Number: </font> <input type=\"text\" name=\"roomtext\" value=\"$rmnum\" size=20></td> 
	  <td><font color=\"#0000CD\">Mail Locator: </font> <input type=\"text\" name=\"mloctext\" value=\"$mloc\" size=20></td>
  	</tr> 
        <tr>
        <td><font color=\"#0000CD\">Department:  </font>
          <select name=\"depttext\">
            <option selected value=\"$deptid\">$deptname</option>";
				while ($row = @mysql_fetch_array($result2)) {
					$deptname = $row[dept_name];
                                       	echo "
            <option value=\"$deptid\">$deptname</option>";
				}
		echo "
            </select></td> 
	  
	  <td><font color=\"#0000CD\">FAX Number: </font> <input type=\"text\" name=\"faxtext\" value=\"$faxnum\" size=20></td>
	</tr>
	<tr>
	  <td><font color=\"#0000CD\">Email: </font><input type=\"text\" name=\"emailtext\" value=\"$email\" size=30></td>
	  <td><font color=\"#0000CD\">Appear in Online Directory: </font><input type=\"checkbox\" name=\"directory\" value=\"1\"";
	  if($type_id == '1')
		{
 			echo" CHECKED>"; 
		}
	 	else
	 	{
			echo">";
		}
		echo"
	  
	  
	  </td>
	</tr> 
	<tr>
	  <td><font color=\"#0000CD\">Official Title: </font><input type=\"text\" name=\"titletext\" value=\"$title\" size=50 ></td> 
	  <td><font color=\"#0000CD\">Working Title: </font> <input type=\"text\" name=\"workingtext\" value=\"$working\" size=50 ></td>
	</tr>  
	<tr>
          <td><font color=\"#0000CD\">Primary Project: </font><textarea name=\"projecttext\" cols=30 rows=10>$project</textarea></td>
          <td><font color=\"#0000CD\">Secondary Project: </font> <textarea name=\"secondarytext\" cols=30 rows=10>$secondary</textarea></td>
	</tr>
	<tr>
	  <td  colspan=\"3\" height=\"54\"> <input type=\"submit\" name=\"Submit\" value=\"Update\" size=\"25\"></td>
    </tr>
  </table>
    <p>&nbsp;</p>
  <p>&nbsp; </p>
</Form>
"; 

	include('/var/www/html/uclit/protected/common/css_login/css_foot2.php');




?>  
