<?php
include($_SERVER['DOCUMENT_ROOT'] . "/API-Others/connection/conn.php");
// error_reporting(E_ALL);
// ini_set('display_errors', '1');
header('content-type:application/json');
$customerName = isset($_POST['customerName']) ? $_POST['customerName'] : '';
$contactNumber = isset($_POST['contactNumber']) ? $_POST['contactNumber'] : '';
$customerLocation = isset($_POST['customerLocation']) ? $_POST['customerLocation'] : '';
$date = DATE("Y-m-d");
$time = DATE("H:i:s");
$sql = ("INSERT INTO customers (CustomerName ,CustomerContact, CustomerLocation, date, time) VALUES ('$customerName','$contactNumber', '$customerLocation', '$date', '$time')");
if (mysqli_query($conn, $sql)) {
    $statusCode = 200;
    $statusMessage = "Saved Successfully";
} else {
    $error = "Error: " . mysqli_error($conn);
}

$resultData = array('code' => $statusCode, 'message' => $statusMessage);
echo json_encode($resultData);
