<?php 
include("inc/db.php");

// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Get the staff ID from the URL
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;

if ($id > 0) {
    // Prepare and execute the query to fetch staff details
    $query = "SELECT * FROM staff_reg WHERE id = $id";
    $result = mysqli_query($db, $query);
    $staff = mysqli_fetch_assoc($result);

    if (!$staff) {
        echo "No staff found with the given ID.";
        exit;
    }
} else {
    echo "Invalid staff ID.";
    exit;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Staff Profile</title>
    <link rel="stylesheet" href="bootstrap-4.6.2-dist/css/bootstrap.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="bootstrap-4.6.2-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <h1 style="padding:70px;" align="center"><b>Staff Profile</b></h1>
    <div class="row">
    <div class="col-md-6">
            <h4>Passport:</h4>
            <img src="uploads/<?php echo htmlspecialchars($staff['good']); ?>" class="img-fluid" alt="Passport Image">
        </div>
        <div class="col-md-6">
            <h4>Full Name:</h4>
            <p><?php echo htmlspecialchars($staff['fname']); ?></p>
        </div>
       
        <div class="col-md-6">
            <h4>Department:</h4>
            <p><?php echo htmlspecialchars($staff['dept']); ?></p>
        </div>
        <div class="col-md-6">
            <h4>Category:</h4>
            <p><?php echo htmlspecialchars($staff['cate']); ?></p>
        </div>
        <div class="col-md-6">
            <h4>Designation:</h4>
            <p><?php echo htmlspecialchars($staff['design']); ?></p>
        </div>
        <div class="col-md-6">
            <h4>Academic Qualification:</h4>
            <p><?php echo htmlspecialchars($staff['academic']); ?></p>
        </div>
        <div class="col-md-6">
            <h4>Publication:</h4>
            <p><?php echo htmlspecialchars($staff['publi']); ?></p>
        </div>
       
        <div class="col-md-6">
            <h4>CV:</h4>
           
        </div>
    </div>
    <a href="staff_list.php" class="btn btn-secondary">Back to List</a>
</div>
</body>
</html>
