<?php 
include "config.php";
session_start();
$user=$_SESSION['log'];
$date = $_POST['date'];
$customer = $_POST['customername'];
$productcode = $_POST['product'];
$productname = $_POST['productname'];
$price = $_POST['price'];
$price_est = $_POST['priceest'];
$date_pro = $_POST['productdate'];
$time = $_POST['producttime'];
$update = "update customerrate set editby='$user',editdate=CURRENT_DATE(),edittime=CURRENT_TIME(),status='deleted' where customer = '$customer' ";
echo $update;
$go = mysqli_query($connect,$update);
foreach ($productcode as $id => $value ){
$sql = "insert into customerrate (date,customer,productcode,productname,price,price_est,editby,edittime,editdate,status) values('$date','$customer','$productcode[$id]','$productname[$id]','$price[$id]','$price_est[$id]','$user','$time[$id]','$date_pro[$id]','')";
echo $sql;
 $go = mysqli_query($connect,$sql);
}
 header('Location:ratemaster.php');
