<?php
session_start();
require_once("config/configDB.php");

function validation_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
    $edit_id   = stripslashes($_POST['edit_id']);

    $vehiclename    = stripslashes($_POST['vehicleno']);
    $brandtype      = stripslashes($_POST['brandtype']);
    $brandname      = stripslashes($_POST['brandname']);
    $model          = stripslashes($_POST['model']);
    $purchasedate   = stripslashes($_POST['purchasedate']);
    $openingkm      = stripslashes($_POST['openingkm']);
	 $openinghrs      = stripslashes($_POST['openinghrs']);
    $vehicletype    = stripslashes($_POST['vehicletype']);
    $ownership      = stripslashes($_POST['ownership']);
	$regname      = stripslashes($_POST['regname']);
	$reg_address      = stripslashes($_POST['reg_address']);
	$companymileage      = stripslashes($_POST['companymileage']);
	$fastag      = "";

    $ins_policynumber   = "";
    $ins_policyfrom     = "";
    $ins_policyto       = "";
    $ins_policyremindon = "";
	$insurancecompany = "";

    $fcnumber       = "";
    $fcfrom         = "";
    $fcto           = "";
    $fcremindon     = "";

    $permitnumber    = "";
    $permitfrom      = "";
    $permitto        = "";
    $permitremindon  = "";
	
	$pypermitnumber    = "";
    $pypermitfrom      = "";
    $pypermitto        = "";
    $pypermitremindon  = "";

    $taxnumber       = "";
    $taxfrom         = "";
    $taxto           = "";
    $taxremindon     = "";
	
	$pytaxnumber       = "";
    $pytaxfrom         = "";
    $pytaxto           = "";
    $pytaxremindon     = "";

    $loannumber       = "";
    $loanfrom         = "";
    $loanto           = "";
    $loanremindon     = "";
    $loan_financier   = "";
    $loan_amt         = "";
    $loan_interest    = "";
    $loan_tenure      = "";
    $loan_emiamt      = "";
    


$sql_update = "UPDATE vehicle_master SET ";
$sql_update .="vehicleno='$vehiclename',";
$sql_update .="brandtype='$brandtype',";
$sql_update .= "brandname='$brandname',"; 
$sql_update .="model='$model',"; 
$sql_update .="purchasedate='$purchasedate',";
$sql_update .="openingkm='$openingkm',"; 
$sql_update .="openinghrs='$openinghrs',"; 
$sql_update .="vehicletype='$vehicletype',";
$sql_update .="vownership='$ownership',";
$sql_update .="regname='$regname',";
$sql_update .="reg_address='$reg_address',";
$sql_update .="companymileage='$companymileage',";
$sql_update .="fastag='$fastag',";
$sql_update .="ins_policynumber='$ins_policynumber',";
$sql_update .="ins_policyfrom='$ins_policyfrom',";
$sql_update .="ins_policyto='$ins_policyto',";
$sql_update .="ins_policyremindon='$ins_policyremindon',";
$sql_update .="insurancecompany='$insurancecompany',";
$sql_update .="fcnumber='$fcnumber',";
$sql_update .="fcfrom='$fcfrom',";
$sql_update .="fcto='$fcto',";
$sql_update .="fcremindon='$fcremindon',";
$sql_update .="permitnumber='$permitnumber',";
$sql_update .="permitfrom='$permitfrom',";
$sql_update .="permitto='$permitto',";
$sql_update .="permitremindon='$permitremindon',";
$sql_update .="pypermitnumber='$pypermitnumber',";
$sql_update .="pypermitfrom='$pypermitfrom',";
$sql_update .="pypermitto='$pypermitto',";
$sql_update .="pypermitremindon='$pypermitremindon',";
$sql_update .="taxnumber='$taxnumber',";
$sql_update .="taxfrom='$taxfrom',"; 
$sql_update .="taxto='$taxto',";
$sql_update .="taxremindon='$taxremindon',";
$sql_update .="pytaxnumber='$pytaxnumber',";
$sql_update .="pytaxfrom='$pytaxfrom',"; 
$sql_update .="pytaxto='$pytaxto',";
$sql_update .="pytaxremindon='$pytaxremindon',";
$sql_update .="loannumber='$loannumber',";
$sql_update .="loanfrom='$loanfrom',";
$sql_update .="loanto='$loanto',";
$sql_update .="loanremindon='$loanremindon',";
$sql_update .="loan_financier='$loan_financier',";
$sql_update .="loan_amt='$loan_amt',";
$sql_update .="loan_interest='$loan_interest',";
$sql_update .="loan_tenure='$loan_tenure',";
$sql_update .="loan_emiamt='$loan_emiamt'";
$sql_update .= "WHERE id='$edit_id' ";
mysqli_query($conn,$sql_update);


$sql_rupdate = "UPDATE vehicle_renewal SET ";
$sql_rupdate .= "ins_policynumber='$ins_policynumber',";
$sql_rupdate .= "ins_policyfrom='$ins_policyfrom',";
$sql_rupdate .= "ins_policyto='$ins_policyto',";
$sql_rupdate .= "ins_policyremindon='$ins_policyremindon',";
$sql_rupdate .= "insurancecompany='$insurancecompany',";
$sql_rupdate .= "fcnumber='$fcnumber',";
$sql_rupdate .= "fcfrom='$fcfrom',";
$sql_rupdate .= "fcto='$fcto',";
$sql_rupdate .= "fcremindon='$fcremindon',";
$sql_rupdate .= "permitnumber='$permitnumber',";
$sql_rupdate .= "permitfrom='$permitfrom',";
$sql_rupdate .= "permitto='$permitto',";
$sql_rupdate .= "permitremindon='$permitremindon',";
$sql_rupdate .= "pypermitnumber='$pypermitnumber',";
$sql_rupdate .= "pypermitfrom='$pypermitfrom',";
$sql_rupdate .= "pypermitto='$pypermitto',";
$sql_rupdate .= "pypermitremindon='$pypermitremindon',";
$sql_rupdate .= "taxnumber='$taxnumber',";
$sql_rupdate .= "taxfrom='$taxfrom',"; 
$sql_rupdate .= "taxto='$taxto',";
$sql_rupdate .= "taxremindon='$taxremindon',";
$sql_rupdate .= "pytaxnumber='$pytaxnumber',";
$sql_rupdate .= "pytaxfrom='$pytaxfrom',"; 
$sql_rupdate .= "pytaxto='$pytaxto',";
$sql_rupdate .= "loannumber='$loannumber',";
$sql_rupdate .= "loanfrom='$loanfrom',";
$sql_rupdate .= " loanto='$loanto',";
$sql_rupdate .= "loanremindon='$loanremindon'";

$sql_rupdate .= "WHERE vehicleno='$edit_id' ";

mysqli_query($conn,$sql_rupdate);
header("Location:vehicleMasterDashboard.php");




?>      