<?php
// Include your database connection code here, and ensure $conn is defined.
include_once 'shikanisha.kts.php';

if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $employeeId = $_GET['id'];

    // Fetch employee details based on the provided ID
    $sql = "SELECT * FROM employees WHERE employee_id = $employeeId";
    $result = mysqli_query($conn, $sql);

    if ($result) {
        $employeeDetails = mysqli_fetch_assoc($result);

        // Return the response as JSON
        header('Content-type: application/json');
        echo json_encode($employeeDetails);
    } else {
        // Handle errors if needed
        echo json_encode(['error' => 'Error fetching employee details']);
    }
} else {
    // Handle non-GET requests
    // You may return an error response or redirect to another page
    echo json_encode(['error' => 'Invalid request method']);
}
?>
