-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_quiz.php
More file actions
43 lines (37 loc) · 1.04 KB
/
select_quiz.php
File metadata and controls
43 lines (37 loc) · 1.04 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
<?php
include("db_connection.php");
// Get student ID from URL
if(!isset($_GET['student_id'])) {
echo "Invalid access!";
exit();
}
$student_id = $_GET['student_id'];
// Fetch all quizzes
$quiz_result = mysqli_query($conn, "SELECT * FROM quiz");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Select Quiz</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2>Select a Quiz</h2>
<?php if(mysqli_num_rows($quiz_result) > 0) { ?>
<ul>
<?php while($quiz = mysqli_fetch_assoc($quiz_result)) { ?>
<li>
<?php echo $quiz['quiz_title']; ?>
- <a href="take_quiz.php?student_id=<?php echo $student_id; ?>&quiz_id=<?php echo $quiz['quiz_id']; ?>">Take Quiz</a>
</li>
<?php } ?>
</ul>
<?php } else { ?>
<p>No quizzes available at the moment.</p>
<?php } ?>
<br>
<a href="student_login.php">Back</a>
</body>
</html>