<?php 
include "config.php";
session_start();
$user=$_SESSION['log'];
$vehicle = $_POST['vehicleno'];
$length = $_POST['length'];
$width = $_POST['width'];
$height = $_POST['height'];
$cft=$_POST['cft'];
$unit = $_POST['unit'];
$chakka = $_POST['chakka'];
$date = $_POST['date'];
$time = $_POST['time'];
echo $vehicle;
$update = mysqli_query($connect,"update cftdetails set status='deleted',editdate=CURRENT_DATE(),edittime=CURRENT_TIME() where vehicleno = '$vehicle[0]'");
echo "update cftdetails set status='deleted',editdate=CURRENT_DATE(),edittime=CURRENT_TIME() where vehicleno = '$vehicle[0]'";
foreach($vehicle as $id => $value){
$sql = "INSERT INTO cftdetails(vehicleno, chakka, length, width, height, cft, unit,time,date,status, editby, editdate, edittime) VALUES ('$vehicle[$id]','$chakka[$id]','$length[$id]','$width[$id]','$height[$id]','$cft[$id]','$unit[$id]',CURRENT_TIME(),CURRENT_DATE(),'','$user','','')";
$go = mysqli_query($connect,$sql);
}
header("Location:master_cft.php");
?>