Correct
Correct
<section>
<h3>Course Coverage Logs</h3>
<?php
$sort_year = isset($_GET['sort_year']) ? $_GET['sort_year'] : '';
$sort_category = isset($_GET['sort_category']) ? $_GET['sort_category'] : '';
$conditions = [];
if (!empty($sort_year)) {
$conditions[] = "y.id = '$sort_year'";
}
if (!empty($sort_category)) {
$conditions[] = "cc.id = '$sort_category'";
}
if (count($conditions) > 0) {
$query .= " WHERE " . implode(' AND ', $conditions);
}
$result = $conn->query($query);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<p><strong>{$row['course_name']} ({$row['year_name']} -
{$row['category_name']})</strong>: {$row['coverage_details']} <em>By {$row['staff_name']} on
{$row['coverage_date']}</em></p>";
}
} else {
echo "<p>No coverage logs found.</p>";
}
?>
</section>
</main>
```
<main>
<h2>Log Course Coverage</h2>
<form action="submit_coverage.php" method="post">
<label for="courseSelect">Select Course:</label>
<select id="courseSelect" name="course_id" required>
<?php
$year_id = $_GET['year_id'] ?? '';
$category_id = $_GET['category_id'] ?? '';
if ($year_id && $category_id) {
$result = $conn->query("SELECT * FROM courses WHERE year_id='$year_id' AND
category_id='$category_id'");
while ($row = $result->fetch_assoc()) {
echo "<option value='{$row['id']}'>{$row['course_name']}</option>";
}
}
?>
</select>
<label for="staffName">Staff Name:</label>
<input type="text" name="staff_name" id="staffName" required>
<label for="coverageDate">Coverage Date:</label>
<input type="date" name="coverage_date" id="coverageDate" required>
<label for="coverageDetails">Coverage Details:</label>
<textarea name="coverage_details" id="coverageDetails" required></textarea>
<label for="confirmation">Confirm Details:</label>
<input type="checkbox" name="confirmed" id="confirmation" required>
<button type="submit">Submit Coverage</button>
</form>
</main>
```
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
```
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
overflow-x: hidden;
background-image: url('../../include/pic.jpg');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 100vh;
}
main {
padding: 20px;
}
h2, h3 {
color: darkslateblue;
}
form {
background-color: rgba(255, 255, 255, 0.8);
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
margin-bottom: 30px;
}
label {
font-weight: bold;
margin-top: 10px;
}
input[type="text"],
input[type="date"],
select,
textarea {
width: calc(100% - 22px);
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
}
button {
padding: 10px 15px;
background-color: darkslateblue;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
}
button:hover {
background-color: slateblue;
}
form {
padding: 15px;
}
.logo {
font-size: 24px;
color: black;
}
.heading ul {
list-style: none;
display: flex;
justify-content: space-between;
}
.heading ul li {
margin: 0 10px;
}
.heading ul li a {
text-decoration: none;
color: orangered;
font-weight: bold;
}
.navclass {
display: flex;
gap: 15px;
}
.navclass a {
color: orangered;
}
.navclass a:hover {
color: darkslateblue;
}
.secfooter {
justify-content: center;
align-items: center;
padding: 10px;
background-color: aqua;
}
.copie {
display: flex;
justify-content: center;
align-items: center;
background-color: aqua;
padding: 10px;
color: orangered;
border-top: 6px solid aqua;
}
.site-map a {
text-decoration: none;
color: blue;
}
.site-map a:hover {
text-decoration: underline;
}
.alert {
padding: 10px;
background: rgba(255, 0, 0, 0.1);
border: 1px solid red;
color: red;
margin: 10px 0;
}
.success {
padding: 10px;
background: rgba(0, 255, 0, 0.1);
border: 1px solid green;
color: green;
margin: 10px 0;
}
```