-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_student.php
More file actions
156 lines (127 loc) · 4.45 KB
/
update_student.php
File metadata and controls
156 lines (127 loc) · 4.45 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
<?php
$conn = mysqli_connect("localhost","root","","project");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$b_id=$_GET['u_id'];
$sql="select * from students where s_id='$b_id'";
$query=mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($query);
if(isset($_POST['Update']))
{
$b_id=$_GET['u_id'];
$name=$_POST['Full_Name'];
$email=$_POST['Email'];
$batch=$_POST['Batch'];
$phone_number=$_POST['Phone_Number'];
$hall=$_POST['Hall'];
$gender=$_POST['Gender'];
$update_query="update students set Full_Name='$name',Batch='$batch',Email='$email',Phone_Number='$phone_number',Hall='$hall',Gender='$gender' where s_id='$b_id'";
$data=mysqli_query($conn,$update_query);
if($data)
{
header("location:student.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>Update Book Details</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
color: #333;
background-color: antiquewhite;
}
h1 {
color: #2c3e50;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
}
h2 {
color: rgb(35, 35, 174)
}
hr {
border: 0;
height: 1px;
background: #ddd;
margin: 20px 0;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="number"] {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
button {
background-color: #3498db;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #2980b9;
}
.quantity-section {
margin-top: 30px;
}
</style>
</head>
<body style="background-color:rgb(222, 233, 240);">
<h1>Update Student Details</h1>
<form action="#" method="post">
<div class="form-group">
<h2 style="color: #2c3e50;">Full Name</h2>
<input type="text" id="authorName" placeholder="Enter full name" name="Full_Name" value="<?php echo $row['Full_Name'] ?>">
</div>
<div class="form-group ">
<h2 style="color: #2c3e50;">Department & Batch</h2>
<input type="text" id="authorName" placeholder="Enter department & batch" name="Batch" value="<?php echo $row['Batch'] ?>">
</div>
<div class="form-group">
<h2 style="color: #2c3e50;">E-mail</h2>
<input type="text" id="authorName" placeholder="Enter e-mail" name="Email" value="<?php echo $row['Email'] ?>">
</div>
<div class="form-group">
<h2 style="color: #2c3e50;">Phone Number</h2>
<input type="text" id="authorName" placeholder="Enter phone number" name="Phone_Number" value="<?php echo $row['Phone_Number'] ?>">
</div>
<div class="form-group">
<h2 style="color: #2c3e50;">Hall</h2>
<input type="text" id="authorName" placeholder="Enter hall" name="Hall" value="<?php echo $row['Hall'] ?>">
</div>
<div class="form-group">
<h2 style="color: #2c3e50;">Gender</h2>
<input type="text" id="authorName" placeholder="Enter gender" name="Gender" value="<?php echo $row['Gender'] ?>">
</div>
<div class="form-actions">
<input type="submit" name="Update" value="Update" style="position: relative;width:150px; height:30px;color: rgb(0, 0, 0);background-color: #89b8d7;font-size: 18px;">
<div style="width:60px;height:30px;border:2px solid black;background-color: #89b8d7;text-align:center;font-size:20px; margin:relative; margin-left: 535px;margin-top:-35px;height:25px "><a href="homepage.php" style="text-decoration: none;color:black;"><span style="color: black;">Back</span></a></div>
<!-- <div><a>Back</a></div>
</div>
</form>
</body>
</html>