<?php
include("../connect.php"); 
$response = array();
if(isset($_POST['policy_name']) && isset($_POST['admin_id']))
{
	$ver = $_POST['admin_id'];
	$c_name=$_POST['policy_name'];
	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d")." ".date('h:i:sa');
	$res_product_stock = mysqli_query($con,"SELECT policy_name FROM  tbl_policy_type where policy_name='$c_name' and admin_id='$ver'");
	if(mysqli_num_rows($res_product_stock)<=0)
	{									
		$query = mysqli_query($con,"INSERT INTO `tbl_policy_type`(`admin_id`,`policy_name`,`status`,`insert_datetime`)VALUES('$ver','$c_name','Active','$cdate')");	
		$response['success']='1';
		$response['details']="Insert Successful";			
	}
	else
	{
		$response['success']='0';
		$response['details']="Vehicle already exists";
	}
}
else
{
	$response['success']='0';
	$response['details']="Required field missing";
}	
echo json_encode($response);
?>