-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsellerprofile.php
More file actions
345 lines (309 loc) · 10.9 KB
/
Copy pathsellerprofile.php
File metadata and controls
345 lines (309 loc) · 10.9 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
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?php
if(!isset($_SESSION)) { session_start(); }
include("header.php");
include("dbconnection.php");
if(!isset($_SESSION['sellerid']))
{
echo "<script>window.location='customerpanel.php';</script>";
}
if($_SESSION['randnumber'] == $_POST['randnumber'])
{
if(isset($_POST['submit']))
{
$sql ="UPDATE seller SET seller_name='$_POST[sellername]', seller_address='$_POST[selleraddress]', state_id='$_POST[state]', city_id='$_POST[city]', pincode='$_POST[pincode]', contact_number='$_POST[contactnumber]', mobile_no='$_POST[mbnumber]', email_id='$_POST[emailid]', bank_name='$_POST[bankname]', bank_branch='$_POST[branch]', bank_IFSC='$_POST[ifsccode]', bank_acno='$_POST[bankacnumber]', status='Active' WHERE seller_id='$_SESSION[sellerid]'";
if(!mysqli_query($con,$sql))
{
echo "Error in mysqli query";
}
else
{
echo "<script>alert('Seller record updated successfully...');</script>";
}
}
}
$randnumber = rand();
$_SESSION['randnumber'] = $randnumber;
if(isset($_SESSION['sellerid']))
{
$sql = "SELECT * FROM seller WHERE seller_id='$_SESSION[sellerid]'";
$qsql = mysqli_query($con,$sql);
$rsedit = mysqli_fetch_array($qsql);
}
?>
<main id="main">
<!-- ======= Cta Section ======= -->
<section id="cta" class="cta">
<div class="container">
<div class="text-center" data-aos="zoom-in">
<br><br>
<h3>Farmer Profile</h3>
</div>
</div>
</section><!-- End Cta Section -->
<!-- ======= Contact Section ======= -->
<section id="contact" class="contact">
<div class="container">
<div class="row">
<div class="col-lg-12" data-aos="fade-up" data-aos-delay="100">
<div class="info mt-4">
<center><h4>Keep Your Profile Updated Here..</h4></center><hr>
<form method="post" action="" name="frmsellprofile" onSubmit="return validatesellprofile()">
<input type="hidden" name="randnumber" value="<?php echo $randnumber; ?>" >
<div class="form-row">
<div class="col-md-6 form-group">
Farmer Name <font color="#FF0000">*</font>
<input type="text" name="sellername" id="sellername" value="<?php echo $rsedit['seller_name']; ?>" autofocus class="form-control" >
</div>
<div class="col-md-6 form-group">
Email ID <font color="#FF0000">*</font>
<input type="email" name="emailid" id="emailid" value="<?php echo $rsedit['email_id']; ?>" class="form-control" >
</div>
<div class="col-md-12 form-group">
Address <font color="#FF0000">*</font>
<textarea name="selleraddress" id="selleraddress" class="form-control"><?php echo $rsedit['seller_address']; ?></textarea>
</div>
<div class="col-md-6 form-group">
State <font color="#FF0000"> *</font>
<span id='loadstate'><select name="state" id="state" class="form-control">
<option value="">Select</option>
<?php
$sql2 = "SELECT * FROM state where status='Active'";
$qsql2 =mysqli_query($con,$sql2);
while($rssql2 = mysqli_fetch_array($qsql2))
{
if($rssql2['state_id'] == $rsedit['state_id'])
{
echo "<option value='$rssql2[state_id]' selected>$rssql2[state]</option>";
}
else
{
echo "<option value='$rssql2[state_id]'>$rssql2[state]</option>";
}
}
?>
</select></span>
</div>
<div class="col-md-6 form-group">
City <font color="#FF0000"> *</font>
<span id='loadcity'><select name="city" id="city" class="form-control">
<option value="">Select</option>
<?php
$sql3 = "SELECT * FROM city where status='Active'";
$qsql3 =mysqli_query($con,$sql3);
while($rssql3 = mysqli_fetch_array($qsql3))
{
if($rssql3['city_id'] == $rsedit['city_id'] )
{
echo "<option value='$rssql3[city_id]' selected>$rssql3[city]</option>";
}
else
{
echo "<option value='$rssql3[city_id]'>$rssql3[city]</option>";
}
}
?>
</select></span>
</div>
<div class="col-md-6 form-group">
Pincode <font color="#FF0000"> *</font>
<input type="number" name="pincode" id="pincode" value="<?php echo $rsedit['pincode']; ?>" class="form-control">
</div>
<div class="col-md-6 form-group">
Contact Number <font color="#FF0000"> *</font>
<input type="number" name="contactnumber" id="contactnumber" value="<?php echo $rsedit['contact_number']; ?>" class="form-control">
</div>
<div class="col-md-6 form-group">
Mobile Number <font color="#FF0000"> *</font>
<input type="number" name="mbnumber" id="mbnumber" value="<?php echo $rsedit['mobile_no']; ?>" class="form-control">
</div>
<div class="col-md-6 form-group">
Bank Name <font color="#FF0000">*</font>
<input type="text" name="bankname" id="bankname" value="<?php echo $rsedit['bank_name']; ?>" autofocus class="form-control" >
</div>
<div class="col-md-6 form-group">
Branch <font color="#FF0000">*</font>
<input type="text" name="branch" id="branch" value="<?php echo $rsedit['bank_branch']; ?>" autofocus class="form-control" >
</div>
<div class="col-md-6 form-group">
IFSC Code <font color="#FF0000">*</font>
<input type="text" name="ifsccode" id="ifsccode" value="<?php echo $rsedit['bank_IFSC']; ?>" autofocus class="form-control" >
</div>
<div class="col-md-6 form-group">
Bank Account Number <font color="#FF0000">*</font>
<input type="text" name="bankacnumber" id="bankacnumber" value="<?php echo $rsedit['bank_acno']; ?>" autofocus class="form-control" >
</div>
</div>
<hr>
<button type="submit" name="submit" id="submit" class="btn btn-info btn-lg btn-block" >Click here to Update Profile</button>
</form>
</div>
</div>
</div>
</div>
</section><!-- End Contact Section -->
</main><!-- End #main -->
<?php
include("footer.php");
?>
<script>
$(document).ready( function () {
$('#datatable').DataTable();
} );
</script>
<script type="application/javascript">
function validatesellprofile()
{
var alphaExp = /^[a-zA-Z]+$/; //Variable to validate only alphabets
var alphaspaceExp = /^[a-zA-Z\s]+$/; //Variable to validate only alphabets and space
var numericExpression = /^[0-9]+$/; //Variable to validate only numbers
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; //Variable to validate Email ID
if(document.frmsellprofile.sellername.value == "")
{
alert("Seller name should not be empty..");
document.frmsellprofile.sellername.focus();
return false;
}
else if(!document.frmsellprofile.sellername.value.match(alphaspaceExp))
{
alert("Please enter only letters for Seller name..");
document.frmsellprofile.sellername.focus();
return false;
}
else if(document.frmsellprofile.selleraddress.value == "")
{
alert("Seller address should not be empty..");
document.frmsellprofile.selleraddress.focus();
return false;
}
else if(document.frmsellprofile.country.value == "")
{
alert("Kindly select the country..");
document.frmsellprofile.country.focus();
return false;
}
else if(document.frmsellprofile.state.value == "")
{
alert("Kindly select the state...");
document.frmsellreg.state.focus();
return false;
}
else if(document.frmsellprofile.city.value == "")
{
alert("Kindly select the city..");
document.frmsellprofile.city.focus();
return false;
}
else if(document.frmsellprofile.pincode.value == "")
{
alert("Kindly enter the pincode..");
document.frmsellprofile.pincode.focus();
return false;
}
else if(document.frmsellprofile.emailid.value == "")
{
alert("Kindly enter the E-Mail ID..");
document.frmsellprofile.emailid.focus();
return false;
}
else if(!document.frmsellprofile.emailid.value.match(emailExp))
{
alert("Kindly enter Valid Email ID.");
document.frmsellprofile.emailid.focus();
return false;
}
else if(document.frmsellprofile.bankname.value == "")
{
alert("Kindly enter the name of the bank...");
document.frmsellprofile.bankname.focus();
return false;
}
else if(!document.frmsellprofile.bankname.value.match(alphaspaceExp))
{
alert("Please enter only letters..");
document.frmsellprofile.bankname.focus();
return false;
}
else if(document.frmsellprofile.branch.value == "")
{
alert("Kindly enter the branch of the bank...");
document.frmsellprofile.branch.focus();
return false;
}
else if(!document.frmsellprofile.branch.value.match(alphaspaceExp))
{
alert("Please enter only letters ..");
document.frmsellprofile.branch.focus();
return false;
}
else if(document.frmsellprofile.ifsccode.value == "")
{
alert("Kindly enter the IFSC Code of the bank...");
document.frmsellprofile.ifsccode.focus();
return false;
}
else if(document.frmsellprofile.ifsccode.value.length > 11)
{
alert("Kindly enter a valid 11 Characters IFSC Code...");
document.frmsellprofile.ifsccode.focus();
return false;
}
else if(document.frmsellprofile.ifsccode.value.length < 11)
{
alert("Kindly enter a valid 11 Characters IFSC Code...");
document.frmsellprofile.ifsccode.focus();
return false;
}
else if(document.frmsellprofile.bankacnumber.value == "")
{
alert("Kindly enter the A/c number of the bank...");
document.frmsellprofile.bankacnumber.focus();
return false;
}
else
{
return true;
}
}
function loadstate(id) {
if (id == "") {
document.getElementById("loadstate").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("loadstate").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET","ajaxstate.php?id="+id+"&profile=set",true);
xmlhttp.send();
}
}
function loadcity(id) {
if (id == "") {
document.getElementById("loadcity").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("loadcity").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET","ajaxcity.php?id="+id+"&profile=set",true);
xmlhttp.send();
}
}
</script>