-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_contacts.php
361 lines (334 loc) · 15.9 KB
/
edit_contacts.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
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php
include("includes/config.inc.php");
include("includes/crosssite.inc.php");
include("includes/simpleimage.php");
if ( isset ( $_GET['logout'] ) && $_GET['logout'] ==1 ) {
session_destroy();
header("location: index.php?token=".$token);
}
if (isset($_SESSION) && $_SESSION['login']=='')
{
session_destroy();
header("location: index.php?token=".$token);
}
$error =0;
if(isset($_POST['submit']))
{
$first_name = mysql_real_escape_string($_POST['first_name']);
$last_name = mysql_real_escape_string($_POST['last_name']);
$company = mysql_real_escape_string($_POST['company']);
$phone = mysql_real_escape_string($_POST['phone']);
$mobile = mysql_real_escape_string($_POST['mobile']);
$email = mysql_real_escape_string($_POST['email']);
$address = mysql_real_escape_string($_POST['address']);
$country = mysql_real_escape_string($_POST['country']);
$state = mysql_real_escape_string($_POST['state']);
$district = mysql_real_escape_string($_POST['district']);
$city = mysql_real_escape_string($_POST['city']);
$area = mysql_real_escape_string($_POST['area']);
$pin_code = mysql_real_escape_string($_POST['pin_code']);
$datasource = mysql_real_escape_string($_POST['datasource']);
$Update = "UPDATE tblcallingdata SET First_Name = '$first_name', Last_Name = '$last_name', Company_Name = '$company', Phone = '$phone', Mobile = '$mobile', email = '$email', Address = '$address', Country = '$country', State = '$state', District_id = '$district', City = '$city', Area = '$area', Pin_code = '$pin_code', data_source = '$datasource' WHERE id =".$_REQUEST['id'];
$result = mysql_query($Update);
$_SESSION['sess_msg']='Contacts updated successfully';
header("location:managecontacts.php?token=".$token);
exit();
}
if(isset($_REQUEST['id']) && $_REQUEST['id'])
{
$queryArr=mysql_query("select * from tblcallingdata where id =".$_REQUEST['id']);
$result=mysql_fetch_assoc($queryArr);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="images/ico.png" type="image/x-icon">
<title><?=SITE_PAGE_TITLE?></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-submenu.min.css">
<link rel="stylesheet" href="css/custom.css">
<script src="js/ajax.js"></script>
<script language="javascript" src="js/manage_contacts.js"></script>
<!--Ajax request Call-->
<script src="js/ajax.js"></script>
<script>
function CallState()
{
country = document.getElementById("country").value;
url="ajaxrequest/getstate.php?country="+country+"&token=<?php echo $token;?>";
/*alert(url);*/
xmlhttpPost(url,country,"GetState");
}
function GetState(str)
{
/*alert(str);*/
document.getElementById('Divstate').innerHTML=str;
}
function CallDistrict()
{
state = document.getElementById("state").value;
url="ajaxrequest/get_district.php?state="+state+"&token=<?php echo $token;?>";
/*alert(url);*/
xmlhttpPost(url,state,"GetDistrict");
}
function GetDistrict(str)
{
/*alert(str);*/
document.getElementById('divdistrict').innerHTML=str;
}
function CallCity()
{
district = document.getElementById("district").value;
url="ajaxrequest/get_city.php?district="+district+"&token=<?php echo $token;?>";
/*alert(url);*/
xmlhttpPost(url,state,"GetCity");
}
function GetCity(str)
{
/*alert(str);*/
document.getElementById('divcity').innerHTML=str;
}
function CallArea()
{
city = document.getElementById("city").value;
url="ajaxrequest/get_area.php?city="+city+"&token=<?php echo $token;?>";
/*alert(url);*/
xmlhttpPost(url,city,"GetArea");
}
function GetArea(str)
{
/*alert(str);*/
document.getElementById('divarea').innerHTML=str;
}
function CallPincode()
{
area = document.getElementById("area").value;
url="ajaxrequest/get_pincode.php?area="+area+"&token=<?php echo $token;?>";
/*alert(url);*/
xmlhttpPost(url,city,"GetPincode");
}
function GetPincode(str)
{
/*alert(str);*/
document.getElementById('divpincode').innerHTML=str;
}
</script>
</head>
<body>
<!--open of the wraper-->
<div id="wraper">
<!--include header-->
<?php include_once('includes/header.php');?>
<!--end-->
<!--open of the content-->
<div class="row" id="content">
<div class="col-md-12">
<h1>Update Contact</h1>
<hr>
</div>
<div class="col-md-12">
<div class="col-md-12" id="contactform"> <!--open of the single form-->
<form name='myform' action="" class="form-horizontal" method="post" onSubmit="return chkcontactform(this)">
<input type="hidden" name="submitForm" value="yes" />
<input type='hidden' name='cid' id='cid' value="<?php if(isset($_GET['id']) and $_GET['id']>0){ echo $_GET['id']; }?>"/>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-10">
<input name="first_name" id="first_name" placeholder="First Name*" class="form-control text_box" type="text" value="<?php if(isset($result['id'])) echo $result['First_Name']; ?>" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-10">
<input name="last_name" id="last_name" class="form-control text_box" value="<?php if(isset($result['id'])) echo $result['Last_Name']; ?>" Placeholder = "Last Name*" type="text" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">Company*</label>
<div class="col-sm-10">
<input name="company" id="company" class="form-control text_box" value="<?php if(isset($result['id'])) echo $result['Company_Name']; ?>" Placeholder="Company Name*" type="text" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">Phone*</label>
<div class="col-sm-10">
<input name="phone" id="phone" class="form-control text_box" value="<?php if(isset($result['id'])) echo $result['Phone']; ?>" Placeholder="Phone*" type="text" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">Mobile*</label>
<div class="col-sm-10">
<input name="mobile" id="mobile" class="form-control text_box" value="<?php if(isset($result['id'])) echo $result['Mobile']; ?>" Placeholder="Mobile*" type="text" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">Email*</label>
<div class="col-sm-10">
<input name="email" id="email" class="form-control text_box" value="<?php if(isset($result['id'])) echo $result['email']; ?>" placeholder="Email*" type="text" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">Address*</label>
<div class="col-sm-10">
<textarea name="address" id="address" cols="6" class="form-control txt_area"><?php if(isset($result['id'])) echo $result['Address']; ?></textarea>
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">Country*</label>
<div class="col-sm-10">
<select name="country" id="country" class="form-control drop_down" onChange="return CallState(this.value)">
<option value="">Select Country</option>
<?php $Country=mysql_query("select * from tblcountry");
while($resultCountry=mysql_fetch_assoc($Country)){
?>
<option value="<?php echo $resultCountry['Country_id']; ?>" <?php if(isset($result['id']) && $resultCountry['Country_id']==$result['Country']){ ?>selected<?php } ?>><?php echo stripslashes(ucfirst($resultCountry['Country_name'])); ?> </option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">State*</label>
<div class="col-sm-10" id="Divstate">
<select name="state" id="state" onChange="return CallDistrict(this.value)" class="form-control drop_down">
<option value="">Select State</option>
<option value="<?php echo $result['State']; ?>" <?php if(isset($result['id']) && $result['State']==$result['State']){ ?>selected<?php } ?>><?php echo getcity(stripslashes(ucfirst($result['State']))); ?></option>
</select>
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">District*</label>
<div class="col-sm-10" id="divdistrict">
<select name="district" id="district" class="form-control drop_down" onChange="return CallCity(this.value)">
<option value="">Select District</option>
<option value="<?php echo $result['District_id']; ?>" <?php if(isset($result['id']) && $result['District_id']==$result['District_id']){ ?>selected<?php } ?>><?php echo getdistrict(stripslashes(ucfirst($result['District_id']))); ?></option>
</select>
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">City*</label>
<div class="col-sm-10" id="divcity">
<select name="city" id="city" onChange="return CallArea(this.value)" class="form-control drop_down" >
<option value="">Select City</option>
<option value="<?php echo $result['City']; ?>" <?php if(isset($result['id']) && $result['City']==$result['City']){ ?>selected<?php } ?>><?php echo getcityname(stripslashes(ucfirst($result['City']))); ?></option>
</select>
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">Area*</label>
<div class="col-sm-10" id="divarea">
<select name="area" id="area" onChange="return CallPincode(this.value)" class="form-control drop_down">
<option value="">Select Area</option>
<option value="<?php echo $result['Area']; ?>" <?php if(isset($result['id']) && $result['Area']==$result['Area']){ ?>selected<?php } ?>><?php echo getarea(stripslashes(ucfirst($result['Area']))); ?></option>
</select>
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">Pincode*</label>
<div class="col-sm-10" id="divpincode">
<select name="pin_code" id="pin_code" class="form-control drop_down">
<option value="">Select Pincode</option>
<option value="<?php echo $result['Pin_code']; ?>" <?php if(isset($result['id']) && $result['Pin_code']==$result['Pin_code']){ ?>selected<?php } ?>><?php echo getpincode(stripslashes(ucfirst($result['Pin_code']))); ?></option>
</select>
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<label for="provider" class="col-sm-2 control-label">Datasource*</label>
<div class="col-sm-10">
<input name="datasource" id="datasource" class="form-control text_box" value="<?php if(isset($result['id'])) echo $result['data_source']; ?>" placeholder="Email*" type="text" />
</div>
</div>
</div>
<div class="col-md-6 form">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" name="submit" value="Submit" class="btn btn-primary btn-sm" id="submit" />
<input type="button" value="Back" id="Back" class="btn btn-primary btn-sm" onClick="window.location='managecontacts.php?token=<?php echo $token ?>'" />
</div>
</div>
</div>
</form>
</div>
<!--end single sim form-->
<div id="contactUpload" style="display:none;" class="col-md-12"> <!--open of the multiple sim form-->
<form name="contact1" method="post" enctype="multipart/form-data" class="form-horizontal" onSubmit="return chkupload(this)">
<div class="col-md-6">
<div class="form-group">
<label for="Datasource" class="col-sm-2 control-label">Datasource</label>
<div class="col-sm-10">
<select name="datasource1" id="datasource1" class="form-control drop_down">
<option label="" value="" selected="selected">Data Source</option>
<?php $Country1=mysql_query("select * from tbldatasource");
while($resultCountry1=mysql_fetch_assoc($Country1)){
?>
<option value="<?php echo $resultCountry1['datasource']; ?>" <?php if(isset($datasource) && $resultCountry1['datasource']==$datasource){ ?>selected<?php } ?>><?php echo stripslashes(ucfirst($resultCountry1['datasource'])); ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="simno" class="col-sm-2 control-label">Upload</label>
<div class="col-sm-10">
<input type="file" id="contactfile" name="contactfile"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" value="Submit" id="submit" class="btn btn-primary" />
<input type="button" value="Download Format" name="download" class="btn btn-primary" onClick="window.location='Samples/Contacts_Import_format.xls'" />
<input type="button" value="Back" id="Back" class="btn btn-primary" onClick="window.location='managecontacts.php?token=<?php echo $token ?>'" />
</div>
</div>
</div>
</form>
</div> <!--end multiple sim-->
</div>
</div>
<!--end of the content-->
<!--open of the footer-->
<div class="row" id="footer">
<div class="col-md-12">
<p>Copyright © 2015 INDIAN TRUCKERS, All rights reserved.</p>
</div>
</div>
<!--end footer-->
</div>
<!--end wraper-->
<!-------Javascript------->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>