

<?php 


include('../conn.php');





if(isset($_POST['submit'])){
 
    $item_name=addslashes($_POST['item_name']);
     $quantity=$_POST['quantity'];
     $datein=$_POST['datein'];
     $by=$_POST['by'];
     $item_dis=$_POST['discription'];
     $purpose=$_POST['purpose'];
     $reciever=$_POST['reciever'];   
$item_id=$item_name;

     $sql10 = "SELECT `unit` FROM `inventory` WHERE `item_id`='".$item_id."'";
     $result10 = $conn->query($sql10);
     $row10=mysqli_fetch_array($result10);
     $unit=$row10['unit'];

     $sql1 = "SELECT `item_name` FROM `inventory_cat` WHERE `item_id`='".$item_id."'";
     $result1 = $conn->query($sql1);
     $row1=mysqli_fetch_array($result1);
    $item_name=$row1['item_name'];
     
      





  
     


     $sql2 = "INSERT INTO `inventory_out`(`item_id`, `item_name`, `quantity`, `units`, `item_dis`, `perpose`, `recirver`, `by`, `date`) VALUES ('$item_id','$item_name','$quantity','$unit','$item_dis','$purpose','$reciever','$by','$datein')";
     if(mysqli_query($conn,$sql2)){

   echo"<script>alert('Item out succefully'); window.location.href='../items_out'</script>";
     }
     else{
       echo 'Error: '.mysqli_error($conn);
     }



}

?>
 