-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenerate_quiz.php
More file actions
56 lines (52 loc) · 1.67 KB
/
generate_quiz.php
File metadata and controls
56 lines (52 loc) · 1.67 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
<?php
require 'bin/functions.php';
require 'db_configuration.php';
$page_title = 'Quiz Master > Generate Quiz';
include('header.php');
$page="questions_list.php";
verifyLogin($page);
// Query the database for keywords
$query = "SELECT `keyword` FROM `keywords`";
$keywords_db = mysqli_query($db, $query);
?>
<html>
<head>
<title>QuizMaster Quiz Generator</title>
<style>
select {
width: 200px;
}
input {
text-align: center;
}
</style>
<!-- Import BootStrap5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<br>
<div style="text-align:center;">
<h3 id="title">Generate New Quiz</h3><br>
<div class="container text-left float-right">
<form action="display_custom_quiz.php" method="POST">
<label>Number of questions to show:</label>
<input required type="number" name="num_questions" maxlength="2" size="10" title="Enter a number">
<br>
<label>Keywords:</label>
<?php
while($row = mysqli_fetch_assoc($keywords_db)) {
echo "<div><input type='checkbox' name='keywords[]' value='" . $row['keyword'] . "'> " . $row['keyword'] . "</div>";
}
?>
<br>
<button type="submit" name="submit" class="btn btn-primary btn-md align-items-center">Generate Quiz</button>
</form>
</div>
</div>
</body>
</html>