forked from Raghunath-Patra/Library-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest_book.php
More file actions
114 lines (99 loc) · 4.31 KB
/
Copy pathrequest_book.php
File metadata and controls
114 lines (99 loc) · 4.31 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
<?php
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
} else {
header("Location:logout.php");
}
if(isset($_POST['request_book'])) {
$book_title = $_POST['book_title'];
$book_author = $_POST['book_author'];
$book_edition = $_POST['book_edition'];
$publication_year = $_POST['publication_year'];
$isbn = $_POST['isbn'];
$lang = $_POST['language'];
$publisher = $_POST['publisher'];
$catagory = $_POST['subject'];
$reason = $_POST['reason'];
$notes = $_POST['notes'];
$connection = new mysqli(server,username,password,database);
if ($connection->connect_error) {
die("Connection failed: " . $connection->connect_error);
}
$query = "INSERT INTO RequestedBooks (roll,book_title,book_author,book_edition,publication_year,isbn,language,publisher,catagory,reason,note)
VALUES ('$_SESSION[roll]','$book_title','$book_author','$book_edition','$publication_year','$isbn','$lang','$publisher','$catagory','$reason','$notes')";
if ($connection->query($query) === TRUE) {
echo '<script> window.alert("Form Submitted Successfully!");</script>';
header("Location:stu_dashboard.php");
}
else{
echo "failed";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Library Management System - Request Book</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section class="request_page">
<div class="request-container">
<h1>Request a book</h1>
<form action="" method="POST">
<div>
<input type="text" id="book_title" name="book_title" placeholder="Book Title:" required>
</div>
<div>
<input type="text" id="book_author" name="book_author"placeholder="Book Author:" required>
</div>
<div>
<input type="text" id="book_edition"placeholder="Edition/Volume:" name="book_edition">
<input type="text" id="publication_year" name="publication_year" placeholder="Publication Year:">
</div>
<div>
<input type="text" id="isbn" name="isbn" placeholder="ISBN:">
<input type="text" id="language" name="language"placeholder="Preferred Language:">
</div>
<div>
<input type="text" id="publisher" name="publisher" placeholder="Publisher:">
</div>
<div>
<input type="text" id="subject" name="subject" placeholder="Subject/Category:">
</div>
<div>
<textarea id="reason" name="reason"placeholder="Reason for Request:"></textarea>
</div>
<div>
<textarea id="notes" name="notes" placeholder="Additional Notes:"></textarea>
</div>
<div>
<button type="submit" name="request_book">Submit Request</button>
</div>
</form>
<script>
function getBookinfo(){
<?php
$connection = new mysqli("localhost","root","","SOI");
if ($_POST['oldpasswd'] == $_SESSION['password'] && $_POST['passwd'] == $_POST['confpasswd'])
{
$query = "UPDATE users SET password='$_POST[passwd]' WHERE roll = '$_SESSION[roll]'";
if ($connection->query($query) === TRUE) {
$_SESSION['password'] = $_POST['passwd'];
echo 'password updated';
header("Location:stu_dashboard.php");
}
else{
echo "failed";
}
}
$connection->close();
?>
}
</script>
</div>
</section>
</body>
</html>