<?php
require_once 'includes/head.php';
header('Content-Type: application/json');

if(isset($_POST['id_number'])) {
    $id_number = mysqli_real_escape_string($conn, $_POST['id_number']);
    $check = mysqli_query($conn, "SELECT id FROM users WHERE id_number = '$id_number'");
    
    echo json_encode(array(
        'exists' => mysqli_num_rows($check) > 0
    ));
}
?>