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