<?php
require_once 'db.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (empty($_POST['id'])) {
        echo "IDが指定されていません。";
        exit;
    }

    $sql = "DELETE FROM customers WHERE id = :id";
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':id', $_POST['id'], PDO::PARAM_INT);
    $stmt->execute();

    header("Location: index.php");
    exit;
}
?>