I just want to find some answer on my problem the error said that the query is undefined variable but i already put all the column needed to my table. here is the html file.
<?php
session_start();
include_once("../CORE/dbconfig.php");
if(isset($_GET['book']))
{
$start_date = $_GET["start_date"];
$end_date = $_GET["end_date"];
$vehicle_id = $_GET["vehicle_id"];
if(isset($_GET['customer_id'])){
$customer_id = $_GET['customer_id'];
if(isset($_GET['vehicle_id'])){
$vehicle_id = $_GET['vehicle_id'];
$rate = $_GET['rate'];
$start_date->format('Y-m-d');
$end_date->format('Y-m-d');
$query = mysqli_query($connect, "INSERT INTO booking (start_date, end_date, rental_amount, vehicle_id, customer_id)
VALUES ('".$start_date."', '".$end_date."', '".$rate."', '".$vehicle_id."', '".$customer_id."')")
or die ("ERROR: " .mysqli_error($connect));
}
}
}
if($query){
echo'<script>
alert("Record Updated!");
window.location.href="homebooking.php";
</script>';
}
else{
echo'<script>
alert("Cannot Be Book!");
window.location.href="homebooking.php";
</script>';
}
?>