-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest.php
49 lines (49 loc) · 1.14 KB
/
test.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
<?php include 'inc/header.php'; ?>
<?php
Session::checkSession();
if (isset($_GET['q'])) {
$num = $exm->checkNumber((int)$_GET['q']);
if (isset($num)) {
$number = $num;
}
}
$total = $exm->getTotalRows();
$question = $exm->getQuestionByNumber($number);
?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$process = $pro->processData($_POST);
}
?>
<div class="main">
<h1>Question <?php echo $question['quesNo']; ?> of <?php echo $total; ?></h1>
<div class="test">
<form method="post" action="">
<table>
<tr>
<td colspan="2">
<h3>Que <?php echo $question['quesNo']; ?>: <?php echo $question['ques']; ?></h3>
</td>
</tr>
<?php
$answer = $exm->getAnswer($number);
if ($answer) {
while ($result = $answer->fetch_assoc()) {
?>
<tr>
<td>
<input type="radio" name="ans" value="<?php echo $result['id']; ?>"/><?php echo $result['ans']; ?>
</td>
</tr>
<?php } } ?>
<tr>
<td>
<input type="submit" name="submit" value="Next Question"/>
<input type="hidden" name="number" value="<?php echo $number; ?>" />
</td>
</tr>
</table>
</form>
</div>
</div>
<?php include 'inc/footer.php'; ?>