<?php
include("includes/db_pdo.php");

if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['student_id'])) {
    $student_id = $_POST['student_id'];

    try {
        $sql = "UPDATE students SET class='', Class_id='', section='', status='inactive' WHERE student_id=?";
        $stmt = $conn->prepare($sql);
        $stmt->execute([$student_id]);

        if ($stmt->rowCount() > 0) {
            echo "success";
        } else {
            echo "error";
        }
    } catch (PDOException $e) {
        echo "error";
    }
}
?>
