-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_course.php
244 lines (191 loc) · 5.29 KB
/
admin_course.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php
// Fetch course list from the database
include("db_connection.php");
session_start();
$query = "SELECT * FROM course";
$result = mysqli_query($con, $query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
<style>
/* Base styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
div.header {
font-family: 'Poppins', sans-serif;
position: fixed;
top: 0;
left: 0;
right: 0;
background: #CADCFC;
z-index: 1000;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 1rem; /* Adjust header padding for smaller screens */
}
div.header h1 {
color: #000000;
font-size: 1rem; /* Adjust header font size for smaller screens */
text-transform: uppercase;
}
div.header button {
font-size: 0.8rem; /* Adjust button font size for smaller screens */
padding: 0.5rem 1rem;
border-radius: 5px;
}
h2 {
text-align: center;
margin-top: 110px;
}
table {
width: 100%; /* Make table width 100% for responsiveness */
max-width: 800px; /* Set maximum width for the table */
margin: 15px auto;
border-collapse: collapse;
background-color: #fff;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}
thead {
background-color: #f7f7f7;
color: #000000;
}
tbody tr:hover {
background-color: #ddd;
}
th, td {
padding: 12px 15px;
text-align: left;
}
tbody tr:nth-child(even) {
background-color: #f2f2f2;
}
a {
text-decoration: none;
color: #007bff;
}
a:hover {
text-decoration: underline;
}
.course-image {
max-width: 100px;
max-height: 100px;
}
.btn {
background-color: #f7f7f7;
color: #000000;
padding: 10px 20px;
border: none;
border-radius: 5px;
text-decoration: none;
font-size: 0.7rem;
margin-bottom: 10px;
margin-top: 10px;
margin-right: 10px; /* Adjust margin-right for spacing */
}
/* Media queries for responsiveness */
@media (max-width: 768px) {
div.header {
padding: 0.5rem; /* Adjust header padding for smaller screens */
}
div.header h1 {
font-size: 1.2rem; /* Reduce header font size for smaller screens */
}
div.header button {
font-size: 0.7rem; /* Reduce button font size for smaller screens */
padding: 0.4rem 0.8rem;
}
table {
max-width: 100%; /* Adjust table width for smaller screens */
}
th, td {
font-size: 0.9rem; /* Reduce font size of table cells for smaller screens */
padding: 10px; /* Adjust padding of table cells for smaller screens */
}
.course-image {
max-width: 80px;
max-height: 80px;
}
.btn {
font-size: 0.6rem; /* Reduce button font size for smaller screens */
padding: 8px 16px; /* Adjust button padding for smaller screens */
}
}
@media (max-width: 480px) {
div.header {
padding: 0.3rem; /* Further adjust header padding for smallest screens */
}
div.header h1 {
font-size: 1rem; /* Further reduce header font size for smallest screens */
}
div.header button {
font-size: 0.6rem; /* Further reduce button font size for smallest screens */
padding: 0.3rem 0.6rem;
}
table {
max-width: 100%; /* Adjust table width to full width for smallest screens */
}
th, td {
font-size: 0.8rem; /* Further reduce font size of table cells for smallest screens */
padding: 8px; /* Further adjust padding of table cells for smallest screens */
}
.course-image {
max-width: 60px;
max-height: 60px;
}
.btn {
font-size: 0.5rem; /* Further reduce button font size for smallest screens */
padding: 6px 12px; /* Further adjust button padding for smallest screens */
}
}
</style>
</head>
<body>
<div class="header">
<a href="admin_pannel.php" class="btn">Go Back</a>
<h1><?php echo $_SESSION['AdminLoginId']?></h1>
<form method="POST">
<a href="course.php" class="btn">Insert</a>
<!-- <button name="Logout">LOG OUT</button> -->
</form>
</div>
<?php
if(isset($_POST['Logout']))
{
session_destroy();
header("location: adminlogin.php");
}
?>
<h2>Course List</h2>
<table>
<thead>
<tr>
<th>Course Name</th>
<th>Price</th>
<th>Image</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<tr>
<td><?php echo $row['course_name']; ?></td>
<td><?php echo $row['price']; ?></td>
<td><img src="<?php echo $row['image']; ?>" alt="Course Image" class="course-image"></td>
<td><a href="edit_course.php?id=<?php echo $row['id']; ?>">Edit</a></td>
<td><a href="view_course.php?id=<?php echo $row['id']; ?>">View</a></td>
<td><a href="delete_course.php?id=<?php echo $row['id']; ?>">Delete</a></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</body>
</html>