-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpedit.php
291 lines (238 loc) · 8.91 KB
/
pedit.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?php
include "linc.php";
if (!isset($_SESSION['pid']))
{
header('Location: plogin.php');
}
//gettig current information which is to be updated
$i=$_SESSION['pid'];
$query="select * from participants where p_id='$i' ";
$r=mysqli_query($mysqli,$query);
$row = mysqli_fetch_assoc($r);
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Update participant</title>
<link rel="shortcut icon" type="image/x-icon" href="images/zephyr-logo.JPG"> <!-- icon shown on top of heading of admin page -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: auto;
background: #eaeaea;
font-family: 'Open Sans', sans-serif;
}
form h1 {
font-size: 18px;
background: #F6AA93 none repeat scroll 0% 0%;
color: rgb(255, 255, 255);
padding: 22px 25px;
border-radius: 5px 5px 0px 0px;
margin: auto;
text-shadow: none;
text-align: left
}
form {
border-radius: 5px;
width: 100%;
margin: 5% auto;
background-color: #FFFFFF;
overflow: hidden;
}
p span {
color: #F00;
}
p {
margin: 0px;
font-weight: 500;
line-height: 2;
color: #333;
}
h1 {
text-align: center;
color: #666;
text-shadow: 1px 1px 0px #FFF;
margin: 50px 0px 0px 0px
}
h3 {
text-align: center;
color: blue;
text-shadow: 1px 1px 0px #FFF;
margin: 50px 0px 0px 0px
}
input {
border-radius: 0px 5px 5px 0px;
border: 1px solid #eee;
margin-bottom: 15px;
width: 75%;
height: 40px;
float: left;
padding: 0px 15px;
}
.form-group {
overflow: inherit;
clear: both;
}
.icon-case {
width: 35px;
float: left;
border-radius: 5px 0px 0px 5px;
background: #eeeeee;
height: 42px;
position: relative;
text-align: center;
line-height: 40px;
}
i {
color: #555;
padding-top: 11px;
}
.contentform {
padding: 40px 30px;
}
.button-contact {
background-color: #81BDA4;
color: #FFF;
text-align: center;
width: 100%;
border: 0;
padding: 17px 25px;
border-radius: 0px 0px 5px 5px;
cursor: pointer;
margin-top: 40px;
font-size: 18px;
}
.leftcontact {
width: 49.5%;
float: left;
border-right: 1px dotted #CCC;
box-sizing: border-box;
padding: 0px 15px 0px 0px;
}
.rightcontact {
width: 49.5%;
float: right;
box-sizing: border-box;
padding: 0px 0px 0px 15px;
}
</style>
</head>
<body>
<!-- updationform -->
<h1>Updation form</h1>
<div class="container">
<form action="" method="post">
<h1>Fill correct details below.</h1>
<div class="contentform">
<div class="leftcontact">
<div class="form-group">
<p>First Name<span>*</span></p>
<span class="icon-case"><i class="fa fa-male"></i></span>
<input type="text" name="fname" value="<?php echo $row['fname']?>" id="f-name" required />
</div>
<div class="form-group">
<p>Middle name <span></span></p>
<span class="icon-case"><i class="fa fa-user"></i></span>
<input type="text" name="mname" value="<?php echo $row['mname']?>" id="m-name" />
</div>
<div class="form-group">
<p>Last Name <span></span></p>
<span class="icon-case"><i class="fa fa-male"></i></span>
<input type="text" name="lname" value="<?php echo $row['lname']?>" id="l-name" />
</div>
<div class="form-group">
<p>E-mail <span>*</span></p>
<span class="icon-case"><i class=" fa fa-envelope-o"></i></span>
<input type="email" name="email" value="<?php echo $row['emailid']?>" id="email" required />
</div>
<div class="form-group">
<p>Phone number <span></span></p>
<span class="icon-case"><i class="fa fa-phone"></i></span>
<input name="pnumber" value="<?php echo $row['pnumber']?>" id="phone" />
</div>
</div>
<div class="rightcontact">
<div class="form-group">
<p>Gender <span>*</span></p>
<select class="form-control" id="gender" name="gender" required style="width: auto;">
<option>female</option>
<option>male</option>
<option>Other</option>
</select>
</div>
<div class="form-group">
<p>Course <span>*</span></p>
<select class="form-control" id="course" required name="course" style="width: 81%;">
<option>B.Tech</option>
<option>M.Tech</option>
<option>P.hd</option>
</select><br>
</div>
<div class="form-group">
<p>College Name <span>*</span></p>
<span class="icon-case"><i class="fa fa-building-o"></i></span>
<input type="text" name="cname" value="<?php echo $row['cname']?>" id="c-name" required/>
</div>
<div class="form-group">
<p>College City <span>*</span></p>
<select class="form-control" id="city" value="<?php echo $row['ccity']?>" name="ccity" required style="width: 81%;">
<option>Jaipur</option>
<option>Mumbai</option>
<option>Lucknow</option>
</select>
</div>
<div class="form-group">
<p>College State <span></span></p>
<select class="form-control" id="state" value="<?php echo $row['cstate']?>" name="cstate" style="width: 81%;">
<option>Delhi</option>
<option>Rajasthan</option>
<option>U.P</option>
</select>
<br>
</div>
</div>
</div>
<button type="submit" name="sub" class="button-contact">Update</button>
</form>
</div>
</body>
<?php
include "linc.php";
if(isset($_POST["sub"]))
{
//alert();
//taking up new data
$fname=mysqli_real_escape_string($mysqli,$_POST["fname"]);
$mname=mysqli_real_escape_string($mysqli,$_POST["mname"]);
$lname=mysqli_real_escape_string($mysqli,$_POST["lname"]);
$gender=mysqli_real_escape_string($mysqli,$_POST["gender"]);
$course=mysqli_real_escape_string($mysqli,$_POST["course"]);
$email=mysqli_real_escape_string($mysqli,$_POST["email"]);
$pnumber=mysqli_real_escape_string($mysqli,$_POST["pnumber"]);
$cname=mysqli_real_escape_string($mysqli,$_POST["cname"]);
$ccity=mysqli_real_escape_string($mysqli,$_POST["ccity"]);
$cstate=mysqli_real_escape_string($mysqli,$_POST["cstate"]);
// $password=mysqli_real_escape_string($mysqli,$_POST["pw"]);
//updation query
$query="update participants set fname='$fname',mname='$mname',lname='$lname',gender='$gender',course='$course',emailid='$email',pnumber='$pnumber',cname='$cname',ccity='$ccity',cstate='$cstate' where p_id='$i'";
// $query="insert into participants (fname,mname,lname,gender,course,emailid,pnumber,cname,ccity,cstate,password) VALUES ('$fname','$mname','$lname','$gender','$course','$email','$pnumber','$cname','$ccity','$cstate','$password')";
if (!mysqli_query($mysqli,$query))
{
echo "query error:".mysqli_error($mysqli);
die();
}
else
{
echo "Successfully updated";
}
//echo "<hr>";
};
?>
</html>