-
Notifications
You must be signed in to change notification settings - Fork 2
/
mbti2.php
46 lines (46 loc) · 1.55 KB
/
mbti2.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
<?php include("connection.php"); ?>
<?php
session_start();
$number = 14;
?>
<!DOCTYPE HTML>
<head>
<title>Personality Test</title>
<link rel="stylesheet" type="text/css" href="css/new.css">
</head>
<body>
<div class="form">
<header>
<h1>SET 2</h1>
</header>
<form action='pprocess2.php' method='post'>
<ul>
<?php while($number!=7): ?>
<?php $query = "select question from `mbti` where qid = $number";
$result = $conn->query($query) or die($conn->error.__LINE__);
$question = $result->fetch_assoc();?>
<li class="question">
<h3><?php echo $question['question']; ?></h3>
<label class="choice">
<?php $query1 = "select option1 from `mbti` where qid = $number";
$result = $conn->query($query1) or die($conn->error.__LINE__);
$choice1 = $result->fetch_assoc(); ?>
<input type="radio" name="answer<?php echo $number?>" value="A" required/>
<span><?php echo $choice1['option1'];?></span>
</label>
<label class="choice">
<?php $query2 = "select option2 from `mbti` where qid = $number";
$result = $conn->query($query2) or die($conn->error.__LINE__);
$choice2 = $result->fetch_assoc(); ?>
<input type="radio" name="answer<?php echo $number?>" value="B" required/>
<span><?php echo $choice2['option2'];?></span>
</label>
</li>
<?php $number--;
endwhile; ?>
</ul>
<button class="button-submit" type="submit">Proceed to Set 3</button>
</form>
</div>
</body>
</html>