<?php
include('db_connection.php');

$query = "SELECT s.*, t.name as teacher_name FROM schemes_of_work s JOIN teachers t ON s.teacher_id = t.teacher_id";
$result = $conn->query($query);
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>View Schemes of Work</title>
    <link rel="stylesheet" href="#">
     <style>
  body {
    font-family: Arial, sans-serif;
}

h2 {
    color: #333;
}

form {
    margin: 20px;
}

label {
    display: block;
    margin-top: 10px;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    box-sizing: border-box;
}

input[type="submit"] {
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 20px;
}

input[type="submit"]:hover {
    background-color: #45a049;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 10px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

    </style>
</head>
<body>
    <h2>Schemes of Work</h2>
    <table>
        <tr>
            <th>Teacher</th>
            <th>Term</th>
            <th>Session</th>
            <th>Subject</th>
            <th>Topics</th>
        </tr>
        <?php while($row = $result->fetch_assoc()): ?>
            <tr>
                <td><?php echo $row['teacher_name']; ?></td>
                <td><?php echo $row['term']; ?></td>
                <td><?php echo $row['session']; ?></td>
                <td><?php echo $row['subject']; ?></td>
                <td><?php echo $row['topics']; ?></td>
            </tr>
        <?php endwhile; ?>
    </table>
</body>
</html>
