<?php

require_once("config/configDB.php"); 
$vehicle   = stripslashes($_POST['vehicle']);

$count=0;
$check_query	= mysqli_query($conn,"SELECT count(vehicle) as counts FROM vehicle_master WHERE vehicle = '$vehicle' "); // Check the database


while($row = mysqli_fetch_array($check_query)){
$count=$row['counts'];
}
if($count!=0){
// Already Exsist


		echo "<script> alert ('Data Inserted Success.');</script>";
		?>
<script language="javascript">window.location.href = "vehicleMaster.php";</script>
<?php
		

}		
else
{

$sql  = "INSERT INTO vehicle_master (vehicle, flag) VALUES ('$vehicle', '1')";

mysqli_query($conn,$sql);
}

header("Location:vehicleMaster.php");


?>