-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_list.php
More file actions
105 lines (91 loc) · 3.25 KB
/
student_list.php
File metadata and controls
105 lines (91 loc) · 3.25 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
// ===== student_list.php =====
include 'functions.php';
$result = null;
// Get all students
$students = getAllStudents($conn);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student List</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333;
background-color: #f4f4f4;
}
</style>
</head>
<body>
<div class="header">
<h1>Student Records Management</h1>
</div>
<div class="container">
<div class="nav">
<a href="register.php">Register Student</a>
<a href="student_list.php">View Students</a>
</div>
<?php if ($result): ?>
<div class="alert <?php echo $result['success'] ? 'alert-success' : 'alert-error'; ?>">
<?php if ($result['success']): ?>
<?php echo $result['message']; ?>
<?php else: ?>
<ul>
<?php foreach ($result['errors'] as $error): ?>
<li><?php echo htmlspecialchars($error); ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="student-count">
<strong>Total Students: <?php echo count($students); ?></strong>
</div>
<div class="table-container">
<div class="table-header">
<h2>Student Records</h2>
<p>Manage all student information from this panel</p>
</div>
<?php if (empty($students)): ?>
<div class="no-data">
<h3>No Student Records Found</h3>
<p>Start by <a href="register.php" class="btn btn-success">registering a new student</a></p>
</div>
<?php else: ?>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
</tr>
</thead>
<tbody>
<?php foreach ($students as $student): ?>
<tr>
<td><?php echo htmlspecialchars($student['id']); ?></td>
<td><?php echo htmlspecialchars($student['first_name'] . ' ' . $student['last_name']); ?></td>
<td><?php echo htmlspecialchars($student['email']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div style="text-align: center; margin-top: 20px;">
<a href="register.php" class="btn btn-success">Add New Student</a>
</div>
</div>
</body>
</html>
<?php mysqli_close($conn); ?>