-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_book.php
More file actions
178 lines (148 loc) · 4.52 KB
/
update_book.php
File metadata and controls
178 lines (148 loc) · 4.52 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
$conn = mysqli_connect("localhost","root","","project");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$b_id=$_GET['u_id'];
$sql="select * from book where b_id='$b_id'";
$query=mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($query);
if(isset($_POST['Update']))
{
$b_id=$_GET['u_id'];
$b_name=$_POST['b_name'];
$b_author=$_POST['b_author'];
$quantity=$_POST['quantity'];
$update_query="update book set b_name='$b_name',b_author='$b_author',quantity=$quantity where b_id='$b_id'";
$data=mysqli_query($conn,$update_query);
if($data)
{
header("location:book.php");
}
else
{
die("Connection failed: " . mysqli_connect_error());
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Book Details Form</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: rgb(106, 128, 118);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
}
.form-container {
background-color: rgb(213, 224, 220);
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 30px;
width: 100%;
max-width: 500px;
}
.form-title {
font-size: 24px;
font-weight: 600;
color: #2c3e50;
margin-bottom: 25px;
text-align: center;
padding-bottom: 10px;
border-bottom: 2px solid #eee;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-size: 16px;
color: #3b3a3a;
margin-bottom: 8px;
font-weight: 500;
}
.form-group input {
width: 100%;
padding: 12px 15px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 16px;
transition: border-color 0.3s;
}
.form-group input:focus {
outline: none;
border-color: #3498db;
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
.form-actions {
display: flex;
justify-content: space-between;
margin-top: 30px;
}
.btn {
padding: 12px 25px;
border: none;
border-radius: 6px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.btn-add {
background-color: #548db5;
color: white;
}
.btn-add:hover {
background-color: #27ae60;
}
.btn-update {
background-color: #3498db;
color: white;
}
.btn-update:hover {
background-color: #2980b9;
}
.btn-delete {
background-color: #e74c3c;
color: white;
}
.btn-delete:hover {
background-color: #c0392b;
}
</style>
</head>
<body>
<div class="form-container">
<h2 class="form-title"><b>Upade Book Details</b></h2>
<form action="#" method="post">
<div class="form-group">
<label for="book-name"><b>Book Name</b></label>
<input type="text" id="book-name" placeholder="Enter the Book name.." name="b_name" value="<?php echo $row['b_name'] ?>" >
</div>
<div class="form-group">
<label for="author-name"><b>Author Name</b></label>
<input type="text" id="author-name" placeholder="Enter the Author name.." name="b_author" value="<?php echo $row['b_author'] ?>">
</div>
<div class="form-group">
<label for="quantity"><b>Quantity</b></label>
<input type="text" id="quantity" placeholder="Enter the quantity.." name="quantity" value="<?php echo $row['quantity'] ?>">
</div>
<div class="form-actions">
<input type="submit" name="Update" value="Update" style="position: relative;margin-left: 150px;width:150px; height:30px;color: rgb(0, 0, 0);background-color: #89b8d7;font-size: 18px;">
</div>
</form>
</div>
</body>
</html>