-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin_editbooks.php
137 lines (100 loc) · 4.25 KB
/
admin_editbooks.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
128
129
130
131
132
133
134
135
136
137
<?php
include_once './connection/config.php';
$book_title = htmlspecialchars($_GET['book_title']);
$sql = "SELECT * FROM books WHERE title = ?";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param('s', $book_title);
$stmt->execute();
$result = $stmt->get_result();
$book = $result->fetch_assoc();
$_SESSION['username'] = "Deepak";
$username = $_SESSION['username'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Boxicons -->
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
<!-- My CSS -->
<link rel="stylesheet" href="./css/admindashboard.css">
<link rel="stylesheet" href="./css/admin_add_book.css">
<title>Dashboard Admin: <?php echo $username ?> </title>
</head>
<body>
<!-- SIDEBAR -->
<?php include 'admin_sidebar.php' ?>;
<!-- SIDEBAR -->
<!-- CONTENT -->
<section id="content">
<!-- NAVBAR -->
<nav>
<a href="#" class="nav-link">Admin Dashboard : Edit Book</a>
<div class="nav-link-2">
<a href="admin_profile.php" class="profile">
<img src="img/people.png">
</a>
</div>
</nav>
<!-- NAVBAR -->
<div class="addbook-container" id="main-content">
<h1>Edit Book Details</h1>
<form action="admin_editbook.php" method="POST" class="form-group">
<input type="hidden" name="book_id" value="<?php echo $book['id']; ?>">
<div class="input-group">
<label for="title">Book Title:</label>
<input type="text" id="title" name="title" value="<?php echo htmlspecialchars($book['title']); ?>">
</div>
<div class="input-group">
<label for="author">Author:</label>
<input type="text" id="author" name="author"
value="<?php echo htmlspecialchars($book['author']); ?>">
</div>
<div class="input-group">
<label for="genre">genre:</label>
<input type="text" id="genre" name="genre" value="<?php echo htmlspecialchars($book['genre']); ?>">
</div>
<div class="input-group">
<label for="pub_year">Published year:</label>
<input type="text" id="pub_year" name="pub_year"
value="<?php echo htmlspecialchars($book['pub_year']); ?>">
</div>
<div class="input-group">
<label for="isbn">isbn:</label>
<input type="text" id="isbn" name="isbn" value="<?php echo htmlspecialchars($book['isbn']); ?>">
</div>
<div class="input-group">
<label for="publisher">Publisher:</label>
<input type="text" id="publisher" name="publisher"
value="<?php echo htmlspecialchars($book['publisher']); ?>">
</div>
<div class="input-group">
<label for="price">Price:</label>
<input type="number" id="price" name="price"
value="<?php echo htmlspecialchars($book['price']); ?>">
</div>
<div class="input-group">
<label for="stock">stock:</label>
<input type="number" id="stock" name="stock"
value="<?php echo htmlspecialchars($book['stock']); ?>">
</div>
<input type="submit" name="edit_book" style="width: 8rem; height: 3rem; margin-left: 45px;" value="Update Book">
</form>
</div>
</section>
<!-- CONTENT -->
<script>
const allSideMenu = document.querySelectorAll('#sidebar .side-menu.top li a');
allSideMenu.forEach(item => {
const li = item.parentElement;
item.addEventListener('click', function () {
allSideMenu.forEach(i => {
i.parentElement.classList.remove('active');
})
li.classList.add('active');
})
});
</script>
</body>
</html>