-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewCourses.php
49 lines (46 loc) · 1.46 KB
/
viewCourses.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
session_start();
require 'DatabaseConnection.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
$db = new Database();
$courses = $db->getCourses();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Available Courses</title>
</head>
<body>
<?php include 'header.php';?>
<h1>Available Courses</h1>
<table>
<thead>
<tr>
<th>Course ID</th>
<th>Course Code</th>
<th>Course Name</th>
<th>Instructor</th>
<th>Credits</th>
<th>Semester</th>
</tr>
</thead>
<tbody>
<?php foreach ($courses as $course): ?>
<tr>
<td><?php echo htmlspecialchars($course['course_id']); ?></td>
<td><?php echo htmlspecialchars($course['course_code']); ?></td>
<td><?php echo htmlspecialchars($course['course_name']); ?></td>
<td><?php echo htmlspecialchars($course['instructor_name']); ?></td>
<td><?php echo htmlspecialchars($course['credits']); ?></td>
<td><?php echo htmlspecialchars($course['semester']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<a href="dashboard.php">Back to Dashboard</a>
</body>
</html>