-
Notifications
You must be signed in to change notification settings - Fork 0
/
addbook.php
127 lines (106 loc) · 5.47 KB
/
addbook.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
require 'includes/snippet.php';
require 'includes/db-inc.php';
include "includes/header.php";
if(isset($_POST['submit'])){
$title = sanitize(trim($_POST['title']));
$author = sanitize(trim($_POST['author']));
$label = sanitize(trim($_POST['label']));
$bookCopies = sanitize(trim($_POST['bookCopies']));
$publisher = sanitize(trim($_POST['publisher']));
$select = sanitize(trim($_POST['select']));
$category = sanitize(trim($_POST['category']));
$call = sanitize(trim($_POST['call']));
$sql = "INSERT INTO books(bookTitle, author, ISBN, bookCopies, publisherName, available, categories, callNumber)
values ('$title','$author','$label','$bookCopies','$publisher','$select','$category','$call')";
$query = mysqli_query($conn, $sql);
if($query){
echo "<script>alert('New Book has been added ');
location.href ='bookstable.php';
</script>";
}
else {
echo "<script>alert('Book not added!');
</script>";
}
}
?>
<div class="container">
<?php include "includes/nav.php"; ?>
<div class="container col-lg-9 col-md-11 col-sm-12 col-xs-12 col-lg-offset-2 col-md-offset-1 col-sm-offset-0 col-xs-offset-0 " style="margin-top: 20px">
<div class="jumbotron login2 col-lg-10 col-md-11 col-sm-12 col-xs-12">
<p class="page-header" style="text-align: center">ADD BOOK</p>
<div class="container">
<form class="form-horizontal" role="form" enctype="multipart/form-data" action="addbook.php" method="post">
<div class="form-group">
<label for="Title" class="col-sm-2 control-label">BOOK TITLE</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title" placeholder="Enter Title" id="password" required>
</div>
</div>
<div class="form-group">
<label for="Author" class="col-sm-2 control-label">AUTHOR</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="author" placeholder="Enter Author" id="password" required>
</div>
</div>
<div class="form-group">
<label for="ISBN" class="col-sm-2 control-label">ISBN</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="label" placeholder="Enter ISBN" id="password" required>
</div>
</div>
<div class="form-group">
<label for="Book Copies" class="col-sm-2 control-label">BOOK COPIES</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="bookCopies" placeholder="Enter BOOK COPIES" id="password" required>
</div>
</div>
<div class="form-group">
<label for="Publisher" class="col-sm-2 control-label">PUBLISHER</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="publisher" placeholder="Enter Publisher" id="password" required>
</div>
</div>
<div class="form-group">
<label for="Password" class="col-sm-2 control-label">AVAILABLE</label>
<div class="col-sm-10">
<select custom-select custom-select-lg name="select" required>
<option>SELECT</option>
<option>YES</option>
<option>NO</option>
</select>
</div>
</div>
<div class="form-group">
<label for="Publisher" class="col-sm-2 control-label">CATEGORY</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="category" placeholder="Enter Category" id="password" required>
</div>
</div>
<div class="form-group">
<label for="Publisher" class="col-sm-2 control-label">CALL NUMBER</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="call" placeholder="Enter Phone number" id="password" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button name="submit" class="btn btn-info col-lg-12" data-toggle="modal" data-target="#info">
ADD BOOK
</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript">
window.onload = function () {
var input = document.getElementById('title').focus();
}
</script>
</body>
</html>