-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_courses.php
More file actions
57 lines (52 loc) · 1.54 KB
/
student_courses.php
File metadata and controls
57 lines (52 loc) · 1.54 KB
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
50
51
52
53
54
55
56
57
<?php
session_start();
include 'db.php';
if (!isset($_SESSION['student'])) {
header("Location: login.php");
exit();
}
$id = $_SESSION['student'];
$result = mysqli_query($conn, "
SELECT c.course_name, c.credit_hours, t.name AS teacher_name
FROM enrollments e
JOIN courses c ON e.course_id = c.id
JOIN teachers t ON c.teacher_id = t.id
WHERE e.student_id = '$id'
");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Enrolled Courses</title>
<style>
body { margin: 0; font-family: Arial, sans-serif; background: #f5f6fa; }
.main { margin-left: 260px; padding: 40px; }
table { width: 90%; margin: 0 auto; border-collapse: collapse; background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
th, td { border: 1px solid #ddd; padding: 12px; text-align: center; }
th { background: #004d00; color: #ffcc00; font-size: 16px; }
tr:nth-child(even) { background: #f9f9f9; }
h2 { text-align: center; color: #004d00; margin-bottom: 20px; }
</style>
</head>
<body>
<?php include 'student_sidebar.php'; ?>
<div class="main">
<h2>📚 Enrolled Courses</h2>
<table>
<tr>
<th>Course Name</th>
<th>Teacher</th>
<th>Credit Hours</th>
</tr>
<?php while($row = mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?= htmlspecialchars($row['course_name']) ?></td>
<td><?= htmlspecialchars($row['teacher_name']) ?></td>
<td><?= htmlspecialchars($row['credit_hours']) ?></td>
</tr>
<?php } ?>
</table>
</div>
</body>
</html>