Basically, I have a list of teacher names, departments and a rating for them. Currently, all ratings are 5/10, however that'll change soon.
So basically, 2 teachers will come up. Mr Smith and Mr White for example. 2 pictures will appear representing each teacher, besides the image, the teacher's name & department comes up. You click the image for the teacher that you think has a higher rating, if you get it right, you go to correct.php, otherwise, you go to incorrect.php.
Here's the code. It just doesnt work when I click the icon, could somebody possibly edit the code so that it'll work, or tell me how I'd do it? Thanks.
<p class="large">Who's got a higher rating?</p>
<img src="icon.png" onclick="one()" class="icon 1"><br>
<div class="text-1"><?php echo "Name: " . $teacher1 . "<br>" . "Department: " . $teacher1department . "<br>" . "Rating: " . $teacher1rating;?></div></br>
<div class="text-2"><br><?php echo "Name: " . $teacher2 . "<br>" . "Department: " . $teacher2department . "<br>" . "Rating: " . $teacher1rating;?></div></br>
<img src="icon.png" onclick="two()" class="icon 2"><br>
<?php
/* Tells you who got the higher rating */
if($teacher1rating > $teacher2rating) {
$higherRating = $teacher1;
}
if($teacher1rating < $teacher2rating) {
$higherRating = $teacher2;
}
function one() {
$guessed = $teacher1;
if($guessed == $higherRating) {
header( 'Location: correct.php' ) ;
}
else {
header( 'Location: incorrect.php')
}
}
function two() {
$guessed = $teacher2;
if($guessed == $higherRating) {
header( 'Location: correct.php' ) ;
}
else {
header( 'Location: incorrect.php')
}
}
?>