<?php
include('dbconnect.php');


if(isset($_POST["monetary"]))
{
 $salarycode = 'ATVRAF-01';
 $order_id = uniqid();
 for($count = 0; $count < count($_POST["monetary"]); $count++)
 {  
  $query = "INSERT INTO compensation
  (salarycode, monetaryid,  amount) 
  VALUES (:salarycode, :monetaryid, :amount)
  ";
  $statement = $conn->prepare($query);
  $statement->execute(
   array(
    ':salarycode'   => $salarycode,
    ':monetaryid'  => $_POST["monetary"][$count], 
    ':amount' => $_POST["amount"][$count], 
    
   )
  );
 }
 $result = $statement->fetchAll();
 if(isset($result))
 {
  echo 'ok';
 }
}
mysqli_close($conn);
?>