<?php 
include("../config.php");
if(!empty($_POST)){
	$id            = mysqli_real_escape_string($conn, $_POST['id']);
	$close_diesel       		= mysqli_real_escape_string($conn, $_POST['close_diesel']);
	$close_date       	= mysqli_real_escape_string($conn, date('Y-m-d', strtotime($_POST['close_date'])));
	$updated_id         = $_SESSION['user_detail']['id'];
	$updated_datetime   = date('Y-m-d H:i:s');

	if($_POST["id"] != ''){
		// $trip_id = $_POST['delete'];
  	// $type      = 'bill_conformation';
		$user_id   = $_SESSION['user_detail']['id'];
		$data      = serialize($_POST);
  	 	
  	 	$insert = "UPDATE `trip` SET `close_diesel` = '".$close_diesel."',`cancel_flag` = 'C',`close_date` ='".$close_date."',`updated_id`='".$updated_id."',`updated_datetime`='".$updated_datetime."' WHERE `id` = '".$id."'";
  	 	
  	 	$result = mysqli_query($conn,$insert) or die( mysqli_error($conn) );

    // $query = "UPDATE trip SET cancel_flag = 'C' WHERE id = '".$id."'";
    // $result = mysqli_query($conn, $query);
    }
  echo json_encode( array('response' => 1, 'msg' => 'DATA SAVED SUCCESSFULLY....!!!', 'alert' => 1, 'redirect' => 'index.php?page=trip/list.php') );die();
}else{
  echo json_encode( array('response' => 2, 'msg' => 'Opps', 'alert' => 1, 'redirect' => 'index.php?page=trip/add.php') );die();
} 