-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddbook.php
More file actions
34 lines (25 loc) · 823 Bytes
/
Copy pathaddbook.php
File metadata and controls
34 lines (25 loc) · 823 Bytes
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
<HTML><HEAD><TITLE>HTML Form </TITLE></HEAD>
<BODY>
<?php
session_start();
$name = $_POST['name'];
$userID = $_SESSION['ID'];
$price = $_POST['price'];
$author = $_POST['author'];
$type = $_POST['radio'];
$cat = $_POST['category'];
$avail = 'YES';
var_dump($_POST);
include 'db_conn_test.php';
$conn = OpenCon();
echo "Connected Successfully";
$stmt = $conn->prepare("INSERT INTO BOOK (Name, UserID, Price, Type, Availability, Subject, Author) VALUES (?,?,?,?,?,?,?)");
$stmt->bind_param("ssissss",$name,$userID,$price,$type,$avail,$cat,$author);
;
if ($stmt->execute() === TRUE) {
header('Location: dashboard.php?added=1');
} else {
echo '<script type="text/javascript">alert("Book added")</script>';
}
?>
</BODY></HTML>