<?php
include_once '../includes/processes.php';
$Process = new Login_Process;

$pageLink = basename($_SERVER['REQUEST_URI']);
$Process->check_status($pageLink);
if($_SESSION['dept_id']!=7) {
	
	header("location:../");
}
?>
<?php
   if(isset($_POST['update']))
   {

 $sql = "UPDATE repair_list SET name_of_item='$_POST[name_of_item]',serial_number='$_POST[serial_number]',
 originating_station='$_POST[originating_station]',date_in='$_POST[date_in]',problem='$_POST[problem]',
 date_sent='$_POST[date_sent]',work_done='$_POST[work_done]',date_returned='$_POST[date_returned]',date_returned_to='$_POST[date_returned_to]',
 remark='$_POST[remark]' WHERE id='$_POST[id]'";

       $id= $_POST['id'];


 if(mysql_query($sql)){
    echo '<script type="text/javascript"> alert("Update successfull") </script>';
    header("location:display.php?ac=1");

  /*echo "<br />";
			 echo '<div class="alert alert-success">
			       <a href="#" class="close" data-dismiss="alert">&times;</a>
				   Update successfull
				   </div>';*/
 }

 else
	echo '<script type="text/javascript"> alert("Update did not work") </script>';

   }

  if(isset($_POST['delete']))
  {

 $sql = "DELETE FROM asset_info  WHERE id='$_POST[id]'";

 if(mysql_query($sql)){
     echo '<script type="text/javascript"> alert("Delete Succesful") </script>';
 header("refresh:0; url=update_page.php");
 	

 }
 else
	echo '<script type="text/javascript"> alert("Delete Did Not Work") </script>';

   }
 ?>
