<?php
ob_start();
include("../connect.php");
if(isset($_POST['category_id']) && isset($_POST['product_name']) && isset($_POST['hsn_code']) && isset($_POST['mrp']) && isset($_POST['product_price']) && isset($_POST['mAh_compatible']) &&  isset($_POST['warranty']) && isset($_POST['warranty_description']) && isset($_POST['status']))
	{
	$id=$_POST['category_id'];
	$pname=$_POST['product_name'];
	$hsn_code=$_POST['hsn_code'];
	$mrp=$_POST['mrp'];
	$price=$_POST['product_price'];
	$mAh_compatible=$_POST['mAh_compatible'];
	$warranty=$_POST['warranty'];
	$w_description=$_POST['warranty_description'];
	$status=$_POST['status'];
	
	date_default_timezone_set('Asia/Calcutta');				
	$cdate  = date("Y-m-d")." ".date('H:i:sa');
	$cdate1  = date("Y-m-d");
	
	$add_product=mysqli_query($con,"Insert into `tbl_master_product`(category_id,product_name,hsn_code,mrp,product_price,mAh_compatible,warranty,warranty_description,status,insert_date,tb_insertdatetime) values('$id','$pname','$hsn_code','$mrp','$price','$mAh_compatible','$warranty','$w_description','$status','$cdate1','$cdate')");
	if($add_product)
	{
	    $response['success']=1;
		$response['details']="Product Added Successfully!";
    }
	else
	{
		$response['success']=0;
		$response['details']="Unfortunately Product Not Added!";
	}  
}
else
{	
	$response['success']=0;
	$response['details']="Required fields missing";
}
echo json_encode($response);
?> 