-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquizresult.php
39 lines (32 loc) · 1.48 KB
/
quizresult.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
<?php
$studentid = $_SESSION['StudentID'];
if (isset($_GET['score'])) {
echo $score = '<h1>Your Score is : ' . $_GET['score'].'</h1>';
}
?>
<h1>Question</h1>
<h5>Choose the correct answer.</h5>
<div style="height:250px;overflow-y:auto;">
<?php
@$id = $_GET['id'];
if($id==''){
redirect("index.php");
}
$sql = "SELECT * FROM tblexercise WHERE LessonID = '{$id}'";
$mydb->setQuery($sql);
$cur = $mydb->loadResultList();
foreach ($cur as $res) {
# code...
$sql = "SELECT * FROM tblscore s,tblexercise e WHERE s.ExerciseID=e.ExerciseID AND e.ExerciseID='{$res->ExerciseID}' and StudentID='{$studentid}'";
$mydb->setQuery($sql);
$ans = $mydb->loadSingleResult();
?>
<form>
<div><?php echo $res->Question ; ?></div>
<div class="col-md-3"><input class="radios" type="radio" disabled="true" <?php echo ($ans->Answer==$res->ChoiceA) ? 'CHECKED' : ''; ?>> A. <?php echo $res->ChoiceA; ?></div>
<div class="col-md-3"><input class="radios" type="radio" disabled="true" <?php echo ($ans->Answer==$res->ChoiceB) ? 'CHECKED' : ''; ?>> B. <?php echo $res->ChoiceB; ?></div>
<div class="col-md-3"><input class="radios" type="radio" disabled="true" <?php echo ($ans->Answer==$res->ChoiceC) ? 'CHECKED' : ''; ?>> C. <?php echo $res->ChoiceC; ?></div>
<div class="col-md-3"><input class="radios" type="radio" disabled="true" <?php echo ($ans->Answer==$res->ChoiceD) ? 'CHECKED' : ''; ?>> D. <?php echo $res->ChoiceD; ?></div>
</form>
<?php } ?>
</div>