<?php
include('includes/config.php');
	
	$transact_from = $_POST['transact_from'];
	$transact_to = $_POST['transact_to'];
	$equipments = $_POST['equipments'];
	$client = $_POST['client'];
	$guard = $_POST['id'];
	#$name = $_POST['name'];
	$ammos = $_POST['ammos'];
	
	mysql_query("INSERT INTO monitoring (`transact_from`, `transact_to`, `guards`, `client`, `equipments`) 
				VALUES('$transact_from', '$transact_to', '$guard', '$client','$equipments')
				") or die(mysql_error());
				
mysql_query("UPDATE employees SET assignment='Assigned' WHERE emp_id ='$guard'") or die(mysql_error()); 
mysql_query("UPDATE equipments SET status='used' WHERE name ='$equipments'") or die(mysql_error()); 				
			
echo "success";
//for history log
mysql_query("INSERT INTO history (`data`,`actions`,`date`,`user`)
			VALUES('$transact_from $transact_to', 'added transaction', '$pc_date $pc_time', '$user')")or die(mysql_error());	
echo "yay!"
			?>
