<?php
include("connect.php");
include("connectp.php");

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $cprogramcode = $_POST['cprogramcode'];
    /* $email = 'at.zeelsheth@gmail.com'; */
    
    // Perform a database query to check if the email exists
    $query = "SELECT COUNT(*) AS count FROM res_course_master WHERE cprogramcode = :cprogramcode";
    $stmt = $db7->prepare($query);
    $stmt->bindParam(':cprogramcode', $cprogramcode);
    $stmt->execute();
    $result = $stmt->fetch();
    $count = $result['count'];
    
    if ($count > 0) {
        echo 'exists';
    } else {
        echo 'unique';
    }
}
?>
