<?php
include '../../connect.php';
session_start();

// Validasi parameter GET
if (!isset($_GET['kenderaanID']) || empty($_GET['kenderaanID'])) {
    echo "<script>alert('Ralat: ID kenderaan tidak sah.'); window.location.href = '../daftarKenderaan.php';</script>";
    exit;
}

$kenderaanID = $_GET['kenderaanID'];

		$query="DELETE FROM kenderaan WHERE kenderaanID = '".$kenderaanID."'";
		$strQuery = mysqli_query($conn,$query);
		
		if($strQuery) 
			{	

					echo "<script>alert('Maklumat kenderaan berjaya dipadam.');";
					echo "window.location.href = '../daftarKenderaan.php';</script>";		
					exit;
			}
			else
			{
				echo 'MySQL Error: ' . mysqli_error($conn);
				exit;
			}
?> 