<?php
include 'koneksi.php';

if (!isset($_POST['id'])) {
    echo json_encode(['success' => false, 'message' => 'ID tidak ditemukan']);
    exit;
}

$id = intval($_POST['id']);

$query = "DELETE FROM absensi WHERE id = $id";
if (mysqli_query($koneksi, $query)) {
    echo json_encode(['success' => true]);
} else {
    echo json_encode(['success' => false, 'message' => mysqli_error($koneksi)]);
}
