-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoxidation.php
More file actions
172 lines (140 loc) · 5.49 KB
/
oxidation.php
File metadata and controls
172 lines (140 loc) · 5.49 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
$reactant1="";
$reactant2="";
$product1="";
$product2="";
$hint="";
$equ="";
$error1="";
$correct="";
$error="";
include 'db_con.php';
//query to dispaly the values from 2or more tables with join
$query="select reactant1,reactant2,product1,product2,hints,word_equations from
reactions join hints on reactions.rid=hints.rea_id
where reactions.reac_type='Redox'
";
$res= queryMysql($query);
$data=array();
while($row= mysqli_fetch_array($res,MYSQLI_ASSOC)){
$data[]=$row;
}
if(!isset($_POST['submit'])){ // echo '<script>alert("PLEASE CLICK THE NEXT BUTTON !")</script>';
//to display the values before botton click
foreach ($data as $val) {
$reactant1=$val['reactant1'];
$reactant2=$val['reactant2'];
$product1=$val['product1'];
$product2=$val['product2'];
$hint=$val['hints'];
$equ=$val['word_equations'];
}
//echo "heii";
}else{
// array_rand($val,7);
// $data[]=$row;
//$count1=array();
// $count=rand(0,100);
// echo $count;
/*$products=$_POST['product2'];
$hidden=$_POST['hidden'];
$count=$_POST['count'];*/
/* if(!isset($_POST['submit1'])){
$error1="CLICK CHECK TO VERIFY ANSWER";
}*/
//gives random values on button click
shuffle($data);
foreach ($data as $val) {
$reactant1=$val['reactant1'];
$reactant2=$val['reactant2'];
$product1=$val['product1'];
$product2=$val['product2'];
$hint=$val['hints'];
$equ=$val['word_equations'];
}}
if(!isset($_POST['submit1'])){$error1="CLICK HERE TO VERIFY ANSWER";
}else{
$decopro=$_POST['decpro'];
$decopro1=$_POST['decopro2'];
$hidden=$_POST['hidden'];
$hidden1=$_POST['hidden1'];
$product1=$hidden;
$product2=$hidden1;
$hint=$_POST['hint'];
$reactant1=$_POST['reactant1'];
$reactant2=$_POST['reactant2'];
$equ=$_POST['equ'];
if($decopro==$hidden&&$decopro1==$hidden1){
$correct="GREAT!ANSWERS CORRECT";
}else{
$error= "THE PRODUCT IS"."<br>".$hidden."<br>".$hidden1;
}
}
?>
<html>
<head>
<meta charset="UTF-8">
<title>combination</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="javascript.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#butmou").click(function(){
$("word").hide();
$("label").hide();
$("proch").hide();
});
});
/* document.getElementById('bulmou').onclick=function(){
document.getElementById('word1').style.visibility='hidden';
return false;
}*/
</script>
</head>
<body>
<header>
<nav>
<!-- <div class="practice">
<a href="index.php"> HOME</a>
<br>
<a href="logout.php"> Logout</a>
<h2> COMBINATION </h2>
</div>-->
</nav>
</header>
<div id="decompprac">
<form id="comid2" action="" method="post">
<h2 id="dechead">OXIDATION/REDUCTION</h2> <br>
<font id='hint' data-toggle="tooltip" data-placement="left" title=" click checkbox for hint">?</font>
<input type="checkbox" id="hint1" name="hint" onclick="showhint();">
<font id="com" color="red" style="display:none" > <?php
echo $hint;
?></font><br><br>
<font id="word" color="blue" > <?php
echo $equ;
?></font>
<br>
<br>
<font id="word2" color="blue" > <?php
echo $reactant1;
?></font>+<font id="word2" color="blue" > <?php
echo $reactant2;
?></font> --->
<input type="text" name="decpro" id="decoinput" placeholder="product1"> +
<input type="text" name="decopro2" id="decoinput1" placeholder="product2"><br><br>
<font id="correct"> <?php echo $correct?></font>
<font id="error2"><?php echo $error?></font><br><br>
<label id="label">The Product:</label>
<input id="proch" type="checkbox" name="proch" onclick="showpro();" style="color: red">
<font id="chep" color="red" style="display:none "> <?php echo $product1;echo "<br>";echo $product2; ?></font>
<input type="hidden" name="hidden" value="<?php echo $product1 ?>">
<input type="hidden" name="hidden1" value="<?php echo $product2 ?>">
<input type="hidden" name="reactant1" value="<?php echo $reactant1?>">
<input type="hidden" name="reactant2" value="<?php echo $reactant2?>">
<input type="hidden" name="hint" value="<?php echo $hint?>">
<input type="hidden" name="equ" value="<?php echo $equ?>">
<br><br>
<button type="submit" name="submit" id='buttonimg' data-toggle="tooltip" data-placement="left" title="click to go to next reaction"><img src="playbutton.gif" alt=/></button>
<button type="submit" name="submit1" id="butmou" data-toggle="tooltip" data-placement="right" title="click to check answers" onclick="onclick();"> <img src="check.gif" alt=/></button>
<?php echo $error1?>