<?php
include 'confing.php';
$response = array();
$vehicle_type = $_POST['vehicle_type'];
$alternate_no = $_POST['alternate_no'];
$block = $_POST['block'];
$share_location = $_POST['share_location'];
$apartment = $_POST['apartment'];
$trakername = $_POST['trakername'];
$type = $_POST['type'];
$user_id = $_POST['user_id'];
$date_time = date("d-m-Y h:i A"); 

$sql = "INSERT INTO generat_qr (vehicle_type, alternate_no, block, share_location, apartment, user_id, date_time, type, trakername
) VALUES (
    '$vehicle_type', '$alternate_no', '$block', '$share_location', '$apartment', '$user_id', '$date_time', '$type', '$trakername'
)";

if (mysqli_query($conn, $sql)) {
    $response['status'] = "success";
    $response['message'] = "Vehicle inserted successfully";
} else {
    $response['status'] = "error";
    $response['message'] = "Database Error: " . mysqli_error($conn);
}

echo json_encode($response);
?>
