/
questionbank.php
64 lines (48 loc) · 1.28 KB
/
questionbank.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
<?php
include("designtemplate.php");
include("database.php");
include("validation.php");
verify_authorization("admin");
connect();
?>
<?php
if (isset($_POST['deletequestions'])){
foreach($_POST as $key => $value){
$arr = explode("_",$key);
if ($arr[0] == 'checkbox')
delete_question($arr[1]);
}
}
?>
<html>
<head>
<title>
Question Bank
</title>
</head>
<body>
<?php
connect();
$questions = get_questions();
?>
<form name = "question_form" method = "post" action = "questionbank.php">
<?php
foreach($questions as $i => $question){
echo "<input type = 'checkbox' name = 'checkbox_".$question['ID']."' value = 'question_".$question['ID']."'>";
echo "   |  ";
echo "<a href = 'managequestion.php?question_id=".$question['ID']."'>edit</a>";
echo "   |  ";
echo $question['Question'];
echo "<br/>\n";
}
?>
<br/>
<input type = "submit" name = "deletequestions" value = "Delete Question(s)">
</form>
<br/><br/>
<form name = "add_question_form" method = "post" action = "managequestion.php">
<input type = "submit" name = "addquestion" value = "Add Question">
</form>
</body>
</html>
<?php include("footer.php");?>