

<?php
require 'connect.php'; // or whatever your DB include is

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['emis_code'])) {
    $emisCode = trim($_POST['emis_code']);
    
    $stmt = $pdo->prepare("SELECT school_name FROM school_emis WHERE emis_code = ?");
    $stmt->execute([$emisCode]);

    if ($row = $stmt->fetch()) {
        echo json_encode(['success' => true, 'school_name' => $row['school_name']]);
    } else {
        echo json_encode(['success' => false]);
    }
}
?>

