-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert_animal.php
52 lines (52 loc) · 1.89 KB
/
insert_animal.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
<?php
session_start();
$VAT_owner = $_SESSION["VAT_client"];
$a_name = $_SESSION['animal_name'];
?>
<html>
<head>
<title> Register animal </title>
</head>
<body>
<font face = "verdana" size = "8">
<center>
<form action="insert_animal_db.php" method="post">
<img src="logo.png" alt="logo" style="width:200px;height:200px;">
<p> <b> <font size="5"> Animal Information Form </font></b> </p>
<table>
<?php echo("<tr><td>VAT Owner</td><td>$VAT_owner</td></tr>"); ?>
<?php echo("<tr><td>Name</td><td>$a_name</td></tr>"); ?>
<tr>
<td>Species</td>
<td><select name="s_name">
<?php
require("connection.php");
$stmt = $connection->prepare("SELECT name FROM species ORDER BY name;");
if ($stmt == FALSE)
{
$info = $connection->errorInfo();
echo("<p>Error: {$info[2]}</p>");
exit();
}
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $row)
{
$name = $row['name'];
echo("<option value=\"$name\">$name</option>");
}
$connection = null;
?>
</select></td>
</tr>
<tr><td> Colour </td><td><input type="text" name="colour" required/></td></tr>
<tr><td> Gender </td><td><input type="text" name="gender" required/></td></tr>
<tr><td> Birth year </td><td><input type="number" name="birth_year" required/></td></tr>
<tr><td> Age </td><td><input type="number" name="age"required/></td></tr>
</table>
<p><input type="submit"/></p>
</form>
</center>
</font>
</body>
</html>