-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
141 lines (139 loc) · 6.96 KB
/
Copy pathadmin.php
File metadata and controls
141 lines (139 loc) · 6.96 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Issue Book</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
function alertMsg(){
alert(Book added successfully...);
window.location.href = "admin_dashboard.php";
}
body{
background: rgba(245, 245, 245, 0.4);
background-image: url("https://img.freepik.com/free-photo/abundant-collection-antique-books-wooden-shelves-generated-by-ai_188544-29660.jpg?size=626&ext=jpg&ga=GA1.1.1546980028.1704240000&semt=sph");
}
</script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<nav class="navbar navbar-expand-lg navbar-light" style="background-color: #e3f2fd">
<div class="container-fluid">
<ul class="nav navbar-nav navbar-center">
<li class="nav-item">
<a class="nav-link" href="admin_dashboard.php">Dashboard</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">Books </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="add_book.php">Add New Book</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_book.php">Manage Books</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">Category </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="add_cat.php">Add New Category</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_cat.php">Manage Category</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">Authors</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="add_author.php">Add New Author</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_author.php">Manage Author</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="issue_book.php">Issue Book</a>
</li>
</ul>
</div>
</nav><br>
<center><h4>Issue Book</h4><br></center>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form action="" method="post">
<div class="form-group">
<label for="book_name">Book Name:</label>
<input type="text" name="book_name" class="form-control" required>
</div>
<div class="form-group">
<label for="book_author">Author ID:</label>
<select class="form-control" name="book_author">
<option>-Select author-</option>
<?php
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$query = "select author_name from authors";
$query_run = mysqli_query($connection,$query);
while($row = mysqli_fetch_assoc($query_run)){
?>
<option><?php echo $row['author_name'];?></option>
<?php
}
?>
</select>
<!--<input type="text" name="book_author" class="form-control" required> -->
</div>
<div class="form-group">
<label for="book_no">Book Number:</label>
<input type="text" name="book_no" class="form-control" required>
</div>
<div class="form-group">
<label for="student_id">Student ID:</label>
<input type="text" name="student_id" class="form-control" required>
</div>
<div class="form-group">
<label for="issue_date">Issue Date:</label>
<input type="text" name="issue_date" class="form-control" value="<?php echo date("yy-m-d");?>" required>
</div>
<button type="submit" name="issue_book" class="btn btn-primary">Issue Book</button>
</form>
</div>
<div class="col-md-4"></div>
</div>
</body>
</html>
<?php
if(isset($_POST['issue_book']))
{
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$query = "insert into issued_books values(null,$_POST[book_no],'$_POST[book_name]','$_POST[book_author]',$_POST[student_id],1,'$_POST[issue_date]')";
$query_run = mysqli_query($connection,$query);
#header("Location:admin_dashboard.php");
}
?>