-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.php
More file actions
executable file
·73 lines (53 loc) · 1.8 KB
/
test2.php
File metadata and controls
executable file
·73 lines (53 loc) · 1.8 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
<div class="container mt-5">
<div class="row">
<div class="col-md-12">
<div class="alert alert-info" role="alert">
Irregular Verb Exercises
</div>
</div>
<div class="col-md-12">
Fill the blank spaces with the appropriate irregular verb.
</div>
<?php
$arrAnswers = array();
$arrVerbs = file('answers.txt');
foreach($arrVerbs as $Verbs) {
list($a,$b,$c) = explode(",",$Verbs);
$arrAnswers[$a] = $Verbs;
}
function SelectBox($search , $true , $key){
global $arrAnswers;
list($a,$b,$c) = explode(",",$arrAnswers[$search]);
return "<select name='cevap' onchange='control(this.value,$true,$key)'>
<option value='0'>Select</option>
<option value='1'>$a</option>
<option value='2'>$b</option>
<option value='3'>$c</option>
</select>
";
}
$arrQuestion = file("question.txt");
echo "<ul>";
foreach ($arrQuestion as $key => $value) {
list($Verb, $True, $cumle) = explode("|", $value);
list($start, $end) = explode("{}", $cumle);
$INPUT = SelectBox($Verb, $True, $key);
echo "\n<li id='$key'>$start $INPUT $end<br> </li>\n";
}
echo "</ul>";
?>
<script>
function control(answers, truee, Key) {
if(answers == 0) {
document.getElementById(Key).style.color = "#000000"
return;
};
if(answers == truee) {
document.getElementById(Key).style.color = "#07C707"
} else {
document.getElementById(Key).style.color = "#FF0000"
}
}
</script>
</div>
</div>