<?php
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
include '../../config.php';

$id = $_GET['id'];
$query = "DELETE FROM kategori_produk WHERE id = $id";

if (mysqli_query($conn, $query)) {
    $_SESSION['alert'] = ['type' => 'success', 'message' => 'Kategori berhasil dihapus.'];
} else {
    $_SESSION['alert'] = ['type' => 'danger', 'message' => 'Gagal menghapus kategori.'];
}

header("Location: daftar_kategori.php");
exit;
