-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiplequestion.php
More file actions
134 lines (133 loc) · 5.58 KB
/
multiplequestion.php
File metadata and controls
134 lines (133 loc) · 5.58 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
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
<?php
include 'lib/Session.php';
Session::checkadminSession();
include('includes/header1.php');
include('includes/menu.php');
$aid = Session::get('aid');
$adminId = Session::get('adminId');
?>
<?php
if(!isset($_GET['mulq']) && $_GET['mulq']==NULL){
echo "<script>window.location='admindashboard.php'</script>";
}else{
$mulqid = $_GET['mulq'];
}
$fgt = $gp->findGroupTokenForAddQues($mulqid);
if($fgt){
$val = $fgt->fetch_assoc();
$gtoken = $val['groupToken'];
}
if(($_SERVER['REQUEST_METHOD']=='POST')){
$msg = $qs->addmulquestion($_POST,$_FILES,$mulqid,$gtoken);
if(isset($msg)){
echo "<script>alert('".$msg."')</script>";
}
}
?>
<script>
function addValueToRadioBtn() {
if (document.getElementById("option1").checked == true){
document.getElementById("option1").value = document.getElementById("mulfiop").value;
}
//added an alert box just to test that the value has been updated
//alert(document.getElementById("amntother").value);
if (document.getElementById("option2").checked == true){
document.getElementById("option2").value = document.getElementById("mulsiop").value;
}
if (document.getElementById("option3").checked == true){
document.getElementById("option3").value = document.getElementById("multhop").value;
}
if (document.getElementById("option4").checked == true){
document.getElementById("option4").value = document.getElementById("mulfoop").value;
}
}
</script>
<div class="container bg-light-gray">
<div class="main-content">
<div class="featured-content">
<section>
<div class="row-fluid">
<div class="span8 offset3">
<form action="" method="POST" enctype="multipart/form-data">
<div class="form-group hgad" style="margin-top: 0px;">
<label style="margin-right: 56px;">Question Title: </label>
<!--<input type="text" class="form-control adgrfs" name="mulqtitle" required="1" placeholder="Question Title">-->
<textarea class="form-control" rows="5" name="mulqtitle" required="1" placeholder="Question Title" ></textarea>
</div>
<div class="form-group hgad">
<label style="margin-right: 70px;">First Option: </label>
<input type="text" class="form-control adgrfs" id="mulfiop" name="mulfiop" placeholder="First Option" required="1">
<label style="cursor:pointer; color:purple;">
<input type="radio" name="mulcs" required="1" id="option1" value="" onclick="addValueToRadioBtn();">Correct Answer?
</div>
<div class="form-group hgad">
<label style="margin-right: 48px;">Second Option: </label>
<input type="text" class="form-control adgrfs" id="mulsiop" name="mulsiop" placeholder="Second Option" required="1">
<label style="cursor:pointer; color:purple;">
<input type="radio" name="mulcs" required="1" id="option2" value="" onclick="addValueToRadioBtn();">Correct Answer?
</div>
<div class="form-group hgad">
<label style="margin-right: 65px;">Third Option: </label>
<input type="text" class="form-control adgrfs" id="multhop" name="multhop" placeholder="Third Option" required="1">
<label style="cursor:pointer; color:purple;">
<input type="radio" name="mulcs" required="1" id="option3" value="" onclick="addValueToRadioBtn();">Correct Answer?
</div>
<div class="form-group hgad">
<label style="margin-right: 54px;">Fourth Option: </label>
<input type="text" class="form-control adgrfs" id="mulfoop" name="mulfoop" placeholder="Fourth Option" required="1">
<label style="cursor:pointer; color:purple;">
<input type="radio" name="mulcs" required= "1" id="option4" value="" onclick="addValueToRadioBtn();">Correct Answer?
</label>
</div>
<button type="submit" class="btn agb" style="background-color: purple;color: white">Add Question</button>
</form>
</div>
</div>
</section>
<section>
<div class="row-fluid">
<div class="span12">
<h2>Question List: </h2><br>
<table class="table table-bordered table-striped">
<thead>
<tr class="warning">
<th width="8%">No.</th>
<th width="12%">Title</th>
<th width="12%">First Option</th>
<th width="12%">Second Option</th>
<th width="12%">Third Option</th>
<th width="12%">Fouth Option</th>
<th width="12%">Correct Ans.</th>
<th width="10%">Action</th>
</tr>
</thead>
<tbody>
<?php
$smresult = $qs->showmultiplequestion($mulqid);
if($smresult){
$i = 0;
while ($value = $smresult->fetch_assoc()) {
$i++;
?>
<tr class="info cta">
<td><?php echo $i;?></td>
<td><?php echo $value['questionTitle']; ?></td>
<td><?php echo $value['mulfiop']; ?></td>
<td><?php echo $value['mulsiop']; ?></td>
<td><?php echo $value['multhop']; ?></td>
<td><?php echo $value['mulfoop']; ?></td>
<td><?php echo $value['mulcs']; ?></td>
<td><a href="deletemulques.php?demq=<?php echo $value['id']; ?>"><button class="btn" style="background-color: purple;color: white">Delete</button></a></td>
</tr>
<?php } }?>
</tbody>
</table>
</div>
</div>
</section>
</div>
</div>
</div>
<?php
include('includes/footer.php');
?>