-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert_animal_db.php
34 lines (34 loc) · 1.05 KB
/
insert_animal_db.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
<?php
session_start();
?>
<html>
<body>
<?php
require("connection.php");
$VAT_owner = $_SESSION["VAT_client"];
$a_name = $_SESSION['animal_name'];
$species = $_REQUEST['s_name'];
$colour = $_REQUEST['colour'];
$gender = $_REQUEST['gender'];
$birth_year = $_REQUEST['birth_year'];
$age = $_REQUEST['age'];
$stmt = $connection->prepare( "INSERT INTO animal VALUES (:a_name, :VAT_owner,:species,:colour,:gender, :birth_year, :age);");
if ($stmt == FALSE)
{
$info = $connection->errorInfo();
echo("<p>Error: {$info[2]}</p>");
exit();
}
$stmt->bindParam(':a_name', $a_name);
$stmt->bindParam(':VAT_owner', $VAT_owner);
$stmt->bindParam(':species', $species);
$stmt->bindParam(':colour', $colour);
$stmt->bindParam(':gender', $gender);
$stmt->bindParam(':birth_year', $birth_year);
$stmt->bindParam(':age', $age);
$stmt->execute();
$connection = null;
header('Location: check_animal.php');
?>
</body>
</html>