-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.php
232 lines (184 loc) · 10.4 KB
/
update.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
include 'connect.php';
if (isset($_POST['update'])){
$id = $_GET['id'];
$firstname =$_POST['fname'];
$lastname =$_POST['lname'];
$mobile =$_POST['phone'];
$email =$_POST['email'];
$fathername =$_POST['fathername'];
$gender =$_POST['gender'];
$collegename =$_POST['collegename'];
$paddress =$_POST['paddress'];
$ppostoffice =$_POST['ppostoffice'];
$pdistrict =$_POST['pdistrict'];
$pstate =$_POST['pstate'];
$ppin =$_POST['ppin'];
$raddress =$_POST['raddress'];
$rpostoffice =$_POST['rpostoffice'];
$rdistrict =$_POST['rdistrict'];
$rstate =$_POST['rstate'];
$rpin =$_POST['rpin'];
$sql = "UPDATE studentlist SET id=$id, firstname='$firstname', lastname='$lastname', mobile='$mobile', email='$email', fathername='$fathername', gender='$gender', collegename='$collegename', paddress='$paddress', ppostoffice='$ppostoffice', pdistrict='$pdistrict', pstate='$pstate', ppin='$ppin', raddress='$raddress', rpostoffice='$rpostoffice', rdistrict='$rdistrict', rstate='$rstate', rpin='$rpin' WHERE id=$id";
$result=mysqli_query($conn,$sql);
header ('location:index.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="style.css">
<title>Monowar Login Form</title>
</head>
<header>
<nav class="navbar navbar-expand bg-light navbar-light navbar-fixed-top ">
<a class="navbar-brand" href="index.php">Monowar</a>
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item active"><a class="nav-link" href="index.php">Home</a></li>
<button type="button" class="btn btn-primary mx-2" onclick="window.location.href='add.php';">Add Student</button>
<button type="button" class="btn btn-primary" onclick="window.location.href='index.php';">Dashboard</button>
</ul>
</nav>
</header>
<body>
<?php
$id=$_GET['id'];
$sql = "SELECT * FROM studentlist WHERE id='$id'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array ($result)
?>
<div class="container">
<div class="header">
<h2>Update Students</h2>
<h4>A Form to Update Students Details.</h4>
<h5>C-DAC Assignment-01 by Monowar Hussain</h5>
</div>
<div class="form" id="form">
<form action="" method="POST">
<div class="form-control1 ">
<label>First Name</label>
<input type="text" id="fname" name="fname" placeholder="Enter Your First Name" value="<?php echo $row['firstname']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1 ">
<label>Last Name</label>
<input type="text" id="lname" name="lname" placeholder="Enter Your Last Name"value="<?php echo $row['lastname']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Mobile Number</label>
<input type="number" id="phone" name="phone" placeholder="Enter Your Mobile Number"value="<?php echo $row['mobile']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Email</label>
<input type="email" id="email" name="email" placeholder="Enter Your Email ID" value="<?php echo $row['email']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Father's Name</label>
<input type="text" id="fathername" name="fathername" placeholder="Enter Your Father's Name"value="<?php echo $row['fathername']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Gender</label>
<input type="text" id="gender" name="gender" placeholder="Enter Your Gender"value="<?php echo $row['gender']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>College Name</label>
<input type="text" id="collegename" name="collegename" placeholder="Enter Your College Name"value="<?php echo $row['collegename']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<!--Residential Addres-->
<div class="float-container">
<div class="raddress" >
<div class="raddressHeader"><h3>Residential Address</h3>
</div>
<div class="form-control1">
<label>Adress</label>
<input type="text" id="raddress" name= "raddress" placeholder="Enter Your Address" value="<?php echo $row['raddress']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Post Office</label>
<input type="text" id="rpostoffice" name="rpostoffice" placeholder="Enter Your Post Office" value="<?php echo $row['rpostoffice']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>District</label>
<input type="text" id="rdistrict" name="rdistrict" placeholder="Enter Your District Name"value="<?php echo $row['rdistrict']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>State</label>
<input type="text" id="rstate" name="rstate" placeholder="Enter Your State Name" value="<?php echo $row['rstate']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Pin</label>
<input type="number" id="rpin" name="rpin" placeholder="Enter Your PIN "value="<?php echo $row['rpin']; ?>" required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
</div>
<!--Permanent Addres-->
<div class="paddress" >
<div class="paddressHeader"><h3>Permanent Address</h3>
<input type="checkbox" id="checkBox" name="checkBox" onchange="addressFunction()"> Same as Residential</div>
<div class="form-control1">
<label>Adress</label>
<input type="text" id="paddress" name="paddress" placeholder="Enter Your Address" value="<?php echo $row['paddress']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Post Office</label>
<input type="text" id="ppostoffice" name="ppostoffice" placeholder="Enter Your Post Office" value="<?php echo $row['ppostoffice']; ?>">
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>District</label>
<input type="text" id="pdistrict" name="pdistrict" placeholder="Enter Your District Name" value="<?php echo $row['pdistrict']; ?>"required>
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>State</label>
<input type="text" id="pstate" name="pstate" placeholder="Enter Your State Name"value="<?php echo $row['pstate']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
<div class="form-control1">
<label>Pin</label>
<input type="number" id="ppin" name="ppin" placeholder="Enter Your PIN "value="<?php echo $row['ppin']; ?>"required >
<i class="fa-solid fa-circle-exclamation"></i>
<i class="fa-solid fa-circle-check"></i>
<small>error msg</small></div>
</div>
</div>
<button name="update" class="btn">Update</button>
</form>
</div>
</div>
<script src="script.js"></script>
</body>
</html>