18 lines
587 B
PHP
18 lines
587 B
PHP
<?php
|
|
// php/update_bantuan_status.php
|
|
require_once 'koneksi.php';
|
|
header('Content-Type: text/plain');
|
|
|
|
$id = intval($_POST['id'] ?? 0);
|
|
$status = trim($_POST['status_penyaluran'] ?? '');
|
|
$valid = ['tersalur','belum','batal'];
|
|
|
|
if (!$id || !in_array($status, $valid)) {
|
|
http_response_code(400); echo 'Data tidak valid.'; exit;
|
|
}
|
|
|
|
$sql = "UPDATE histori_bantuan SET status_penyaluran='" . mysqli_real_escape_string($conn, $status) . "' WHERE id={$id}";
|
|
if (mysqli_query($conn, $sql)) { echo 'success'; }
|
|
else { http_response_code(500); echo 'Gagal: ' . mysqli_error($conn); }
|
|
?>
|