-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanimal_screen2.php
69 lines (53 loc) · 2.74 KB
/
animal_screen2.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
68
69
<!-- this is the animal screen -->
<!DOCTYPE html>
<html>
<head>
<title>DigiVet</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="question">
<?php
include 'database.php';
$query = "SELECT * FROM table_general_question WHERE id_general_question = 1";
$sth = $con->prepare($query);
$sth->execute();
foreach ($sth->fetchAll() as $row) {
print "<p>" . $row['question'] . "</p>";
}
?>
</div>
<button class="play"></button>
<button class="pause"></button>
<form method="get" action="general_information.php">
<div id = "up_images">
<button id="cow" value=<?php $animal = 'cow'; $use_table = 'table_cow'; include 'database.php'; $query = "UPDATE variables_general SET kind_of_animal='$animal', use_table='$use_table'"; $stmt = $con->prepare($query); $stmt->execute(); $conn=null; ?> name ="animal_button" type = "submit" ></button>
<button id="goat" value=<?php $animal = 'goat'; $use_table = 'table_goat'; include 'database.php'; $query = "UPDATE variables_general SET kind_of_animal='$animal', use_table='$use_table'"; $stmt = $con->prepare($query); $stmt->execute(); $conn=null; ?> name ="animal_button" type = "submit" ></button>
<button id="sheep" value=<?php $animal = 'sheep'; $use_table = 'table_sheep'; include 'database.php'; $query = "UPDATE variables_general SET kind_of_animal='$animal', use_table='$use_table'"; $stmt = $con->prepare($query); $stmt->execute(); $conn=null; ?> name ="animal_button" type = "submit" ></button>
</div>
<div id = "down_images">
<button id="pig" value=<?php $animal = 'pig'; $use_table = 'table_pig'; include 'database.php'; $query = "UPDATE variables_general SET kind_of_animal='$animal', use_table='$use_table'"; $stmt = $con->prepare($query); $stmt->execute(); $conn=null; ?> name ="animal_button" type = "submit" ></button>
<button id="dog" value=<?php $animal = 'dog'; $use_table = 'table_dog'; include 'database.php'; $query = "UPDATE variables_general SET kind_of_animal='$animal', use_table='$use_table'"; $stmt = $con->prepare($query); $stmt->execute(); $conn=null; ?> name ="animal_button" type = "submit" ></button>
</div>
</form>
<script>
$(document).ready(function() {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'sounds/animal_type.mp3');
audioElement.setAttribute('autoplay', 'autoplay');
//audioElement.load()
$.get();
audioElement.addEventListener("load", function() {
audioElement.play();
}, true);
$('.play').click(function() {
audioElement.play();
});
$('.pause').click(function() {
audioElement.pause();
});
});
</script>
</body>
</html>