<?php
require_once '../../includes/functions.php';
requireAdmin();
$id = intval($_GET['id'] ?? 0);
$siswa = db_fetch("SELECT * FROM siswa WHERE id = ?", [$id]);
if ($siswa) {
    db_query("DELETE FROM siswa WHERE id = ?", [$id]);
    setFlash('success', "Siswa {$siswa['nama']} berhasil dihapus.");
} else {
    setFlash('danger', 'Data tidak ditemukan.');
}
header('Location: list.php');
exit;
