<?php include 'includes/session.php'; ?>
<?php include 'includes/sessions.php'; ?>
<?php


// Include your database connection code here

if (isset($_POST["term"])) {
    $term = $_POST["term"];

    // Replace the following query with your actual query to fetch names from the database
    $sql = "SELECT name FROM users WHERE name LIKE '%$term%'";
    $result = $conn->query($sql);

    $names = array();
    while ($row = $result->fetch_assoc()) {
        $names[] = $row["name"];
    }

    echo json_encode($names);
}
?>
