
<?php 
error_reporting(0);

include('db_connect.php');
$response = array(); 
if(isset($_POST["id"])){
	$user_id = $_POST['id'];
    $item_name = $_POST['item_name'];
        $item_desc = $_POST['item_desc'];
        $status = $_POST['status'];
         $dated = $_POST['dated'];
 $query="INSERT INTO `grocery_list`(`id`, `item_name`, `item_desc`, `status`, `dated`) VALUES ('$user_id','$item_name','$item_desc','$status','$dated')";
  if(mysqli_query($conn,$query)){
   $response['error'] = false; 
			$response['message'] = "Item Added";

  }else{
   	$response['error'] = true; 
			$response['message'] = "Some error occurred please try again";	
  }
}else{
	echo "error";
}
echo json_encode($response);
mysqli_close($conn);
?>