<?php
session_start();
require_once 'koneksi.php'; // koneksi database kamu

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $id = $_POST['id'] ?? null;

    if ($id) {
        $stmt = $pdo->prepare("UPDATE transactions SET keterangan = 'WD Success' WHERE id = ?");
        if ($stmt->execute([$id])) {
            $_SESSION['success'] = 'Withdraw berhasil di-ACC.';
        } else {
            $_SESSION['error'] = 'Gagal meng-ACC withdraw.';
        }
    } else {
        $_SESSION['error'] = 'ID tidak valid.';
    }
}

header('Location: withdraw'); // arahkan balik ke halaman withdraw
exit;
