<?php
include 'koneksi.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $id     = $_POST['id'];
    $merek  = trim($_POST['merek']);
    $tipe   = $_POST['tipe'];
    $id_area = $_POST['id_area'];

    $stmt = $conn->prepare("UPDATE tbl_kendaraan SET merek=?, tipe=?, id_area=? WHERE id=?");
    $stmt->bind_param("ssii", $merek, $tipe, $id_area, $id);

    if ($stmt->execute()) {
        header("Location: index.php?success=1");
    } else {
        echo "Gagal update data.";
    }
}
