<?php require_once('../Connections/lancrox.php'); ?>
<?php
//insert.php;
//itemname is actually the price of the item which is called from the db too
if(isset($_POST["item_name"]))
{
	$typo=4;
 
 $order_id = uniqid();
 for($count = 0; $count < count($_POST["item_name"]); $count++)
 {  
 	
 
  $query = "INSERT INTO billing1 
  (userid,batch,amount,qty,description,sender,datein,typo) 
  VALUES ('$_POST[userid]','$_POST[batch]',:item_name, :item_quantity, :item_unit,'$_POST[sender]','$today','$typo')
  ";
  $statement = $connect->prepare($query);
  $statement->execute(
   array(
 
    ':item_name'  => $_POST["item_name"][$count], 
    ':item_quantity' => $_POST["item_quantity"][$count], 
    ':item_unit'  => $_POST["item_unit"][$count]
   )
  );
 }
 $result = $statement->fetchAll();
 if(isset($result))
 {
  echo 'ok';
 }
}
?>
