prepare("SELECT * FROM vehicles WHERE id = ?"); $stmt->execute([$vehicle_id]); $vehicle = $stmt->fetch(PDO::FETCH_ASSOC); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $customer_name = $_POST['customer_name'] ?? ''; $customer_email = $_POST['customer_email'] ?? ''; $customer_phone = $_POST['customer_phone'] ?? ''; $start_date = $_POST['start_date'] ?? ''; $end_date = $_POST['end_date'] ?? ''; $status = 'pending'; if ($vehicle_id && !empty($customer_name) && !empty($customer_email) && !empty($start_date) && !empty($end_date)) { $stmt = db()->prepare("INSERT INTO bookings (vehicle_id, customer_name, customer_email, customer_phone, start_date, end_date, status) VALUES (?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$vehicle_id, $customer_name, $customer_email, $customer_phone, $start_date, $end_date, $status]); $booking_id = db()->lastInsertId(); echo '
Thank you! Your booking has been received. We will contact you shortly.
'; } else { echo '
Please fill in all required fields.
'; } } if (!$vehicle) { echo '
Vehicle not found.
'; require_once 'includes/footer.php'; exit; } ?>

Book Vehicle:

<?php echo htmlspecialchars($vehicle['name']); ?>

Type:

Capacity: people

Price: Rp / day