<?php
include('includes/config.php');
	
$name = $_POST['name'];
$type = $_POST['type'];
$serial = $_POST['serial'];
$model = $_POST['model'];
$brand = $_POST['brand'];
$cal = $_POST['cal'];
$quantity = $_POST['quantity'];
$unit = $_POST['unit'];
$price = $_POST['price'];
$license = $_POST['license'];
$permit_from = $_POST['permit_from'];
$permit_to = $_POST['permit_to'];
$user = $_POST['user'];
$pc_date = $_POST['pc_date'];
$pc_time = $_POST['pc_time'];

/* $out = array();
foreach ($guards as $value) {
    array_push($out, "$value");
}	 */
mysql_query("INSERT INTO equipments (`name`, `type`, `serial`, `model`, `brand`, `cal`, `quantity`, `price`, `license`, `permit_from`, `permit_to`, `control_num`) 
						VALUES('$name', '$type', '$serial','$model', '$brand', '$cal', '$quantity $unit', '$price', '$license', '$permit_from', '$permit_to', '$control_num')
			")
			or die(mysql_error());
echo "success";
mysql_query("INSERT INTO history (`data`,`actions`,`date`,`user`)VALUES('$name', 'added equipment', '$pc_date $pc_time', '$user')")or die(mysql_error());	
//for log
?>