-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_tracks.php
67 lines (66 loc) · 2.24 KB
/
test_tracks.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
65
66
67
<?php
session_start();
$link = mysqli_connect("localhost", "root", "", "users");
if(isset($_SESSION['user_name'])==""){
header("Location: loginpage.php");
}
?>
<html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id = "header">
<h1>Practice Tracks</h1>
<div id = "mySidenav" class="sidenav">
<script type="text/javascript" src="JSFiles/nav.js"></script>
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="dashboard.php">Dashboard</a>
<a href="logout.php">Logout</a>
</div>
<span onclick="openNav()" class="button">Menu</span>
</div>
<p><a href = '#' onclick='example()'>Basic Addition</a></p>
<div id="example">
<div>
<p><?php $result = mysqli_query($link,"SELECT Question, Answer FROM tracks WHERE ID = 1");
$row = mysqli_fetch_array($result);
$sol = $row["Answer"];
echo $row["Question"]
?></p>
<form action="" method="post">
<input type="text" name="answer" id="answer" required="">
<input type="submit" value="Submit">
<?php if(isset($_POST['answer'])){
$answ = $_REQUEST['answer'];
if ($answ == $sol){
echo "correct";
}
}?>
<a href="#"onclick='example()'>X</a>
</div>
<script>
function example() {
el = document.getElementById("example");
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}
</script>
</div>
<p><a href = '#' onclick='example1()'>Some Algebra</a></p>
<div id = "example1">
<div>
<p><?php $result = mysqli_query($link,"SELECT Question FROM tracks WHERE ID = 2");
$row = mysqli_fetch_array($result);
echo $row["Question"]
?></p>
</div>
<script>
function example1() {
el = document.getElementById("example1");
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}
</script>
</div>
</body>
</html>