<?php
include 'koneksi.php';

header('Content-Type: text/plain; charset=utf-8');

$id = mysqli_real_escape_string($koneksi, $_POST['id'] ?? '');

if (!$id) {
    echo "Gagal: ID tidak ditemukan!";
    exit;
}

$query = "DELETE FROM `$nama_tabel` WHERE id='$id'";

if (mysqli_query($koneksi, $query)) {
    echo "Data berhasil dihapus!";
} else {
    echo "Gagal menghapus data: " . mysqli_error($koneksi);
}
?>
