<?php
header("Content-Type: text/html; charset=UTF-8");
include('last_db_config.php');

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $national_id = $_POST['national_id'];

    $stmt = $conn->prepare("SELECT Name FROM evaluator WHERE NationalID = ?");
    $stmt->bind_param("s", $national_id);
    $stmt->execute();
    $result = $stmt->get_result();

    if ($row = $result->fetch_assoc()) {
        session_start();
        $_SESSION['evaluator_name'] = $row['Name'];
        header("Location: new_rows_fail_students.php");
        exit;
    } else {
        echo "<script>alert('لم يتم العثور على الرقم القومي، يرجى التسجيل أولاً.'); window.location.href='new_register.php';</script>";
    }
}
?>
