<?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="";
	$today=date("Y-m-d");
		
	$ID = $_POST['ID'];	
	$lnametext = $_POST['lnametext'];
	$fnametext = $_POST['fnametext'];
	$depttext = $_POST['depttext'];
	$bldgtext = $_POST['bldgtext'];
	$roomtext = $_POST['roomtext'];
	$mloctext = $_POST['mloctext'];
	$phonetext = $_POST['phonetext'];
	$faxtext = $_POST['faxtext'];
	$emailtext = $_POST['emailtext'];
	$projecttext = $_POST['projecttext'];
	$secondarytext = $_POST['secondarytext'];
	$titletext = $_POST['titletext'];
	$workingtext = $_POST['workingtext'];
	$type_id = $_POST['directory'];
	
        
        
       	$query= "UPDATE personnel SET last_name=\"$lnametext\", first_name=\"$fnametext\", 
	         	 	room=\"$roomtext\", phone=\"$phonetext\", dept_id=\"$depttext\",
			 		e_mail=\"$emailtext\", duties=\"$projecttext\", duties_sec=\"$secondarytext\", 
			 		title=\"$titletext\", working_title=\"$workingtext\", type_id=\"$type_id\" WHERE personnel_id=\"$ID\"" ;

	$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; $query");
		if (!$result) {
			echo"<P>Couldn't update record!";
		}
		else
		{
        
		$query2= "UPDATE departments SET faxnum=\"$faxtext\", building=\"$bldgtext\", 
	         	 	mail_location=\"$mloctext\" WHERE dept_id=\"$depttext\"" ;

		$db2 = @mysql_select_db($database_uclit_db, $uclit_dbConn)
			or die("Couldn't select database.");
		$result2 = @mysql_query($query2,$uclit_dbConn)
		or die("Couldn't execute query; $query2");
		if (!$result) {
			echo"<P>Couldn't update record!";
			}
		else
		{
                
                
                
                
                
		echo "
<p>Your record has been updated.</p><BR>
<a href=\"javascript: history.go(-2)\">Return to Staff selection.</a>
";}} 


?>
