-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomeredit.php
188 lines (113 loc) · 4.54 KB
/
customeredit.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
<?php
require_once('function.php');
dbconnect();
session_start();
if (!is_user()) {
redirect('index.php');
}
?>
<?php
$user = $_SESSION['username'];
$usid = $pdo->query("SELECT id FROM users WHERE username='".$user."'");
$usid = $usid->fetch(PDO::FETCH_ASSOC);
$uid = $usid['id'];
include ('header.php');
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Edit Customer</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-10 col-md-offset-1">
<?php
$eid = $_GET["id"];
if($_POST)
{
$address = $_POST["address"];
$fullname = $_POST["fullname"];
$phonenumber = $_POST["phonenumber"];
$sex = $_POST["sex"];
$email = $_POST["email"];
$city = $_POST["city"];
$comment = $_POST["comment"];
///////////////////////-------------------->> Catid ki 0??
$error = 0;
$res = $pdo->exec("UPDATE `customer` SET `fullname`='".$fullname."',`phonenumber`='".$phonenumber."',`address`='".$address."',`sex`='".$sex."',`email`='".$email."',`city`='".$city."',`comment`='".$comment."' WHERE id='".$eid."'");
if($res){
echo "<div class='alert alert-success alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
UPDATED Successfully!
<meta http-equiv='refresh' content='2; url=customerview.php' />
</div>";
}else{
echo "<div class='alert alert-danger alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Some Problem Occurs, Please Try Again.
</div>";
}
}
?>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<?php
$oldd = $pdo->query("SELECT * FROM customer WHERE id='".$eid."'");
$old = $oldd->fetch(PDO::FETCH_ASSOC)
?>
<form action="customeredit.php?id=<?php echo $eid ?>" method="post">
<div class="form-group">
<label>Full Name</label><br/>
<input type="text" name="fullname" style="width:200px; height: 40px;" value="<?php echo($old['fullname']) ?>" /><br/><br/>
</div>
<div class="form-group">
<label>Address</label><br/>
<input type="text" name="address" style="width:200px; height: 40px;" value="<?php echo($old['address']) ?>" /><br/><br/>
</div>
<div class="form-group">
<label>City</label><br/>
<input type="text" name="city" style="width:200px; height: 40px;" value="<?php echo($old['city']) ?>" /><br/><br/>
</div>
<div class="form-group">
<label>Phone Number</label><br/>
<input type="text" name="phonenumber" style="width:200px; height: 40px;" value="<?php echo($old['phonenumber']) ?>" /><br/><br/>
</div>
<div class="form-group">
<label>Email</label><br/>
<input type="text" name="email" style="width:200px; height: 40px;" value="<?php echo($old['email']) ?>" /><br/><br/>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Comment</label><br/><br/>
<div class="col-sm-6"><textarea rows="4" cols="50" name="comment" class="form-control" type="text"><?php echo $old['comment']; ?></textarea></div>
</div>
<div class="form-group">
<label>Sex</label>
<select name="sex" class="form-control">
<option value="0" <?php if($old['sex']== 0) echo('selected = "selected"'); ?>>Male</option>
<option value="1"<?php if($old['sex']== 1) echo('selected = "selected"'); ?>>Female</option>
</select><br/>
<input type="submit" class="btn btn-lg btn-success btn-block" value="Update">
</form>
</div>
</div>
<!-- /.row -->
</div>
<!-- /#page-wrapper -->
<script src="js/bootstrap-timepicker.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery("#ssn").mask("999-99-9999");
// Time Picker
jQuery('#timepicker').timepicker({defaultTIme: false});
jQuery('#timepicker2').timepicker({showMeridian: false});
jQuery('#timepicker3').timepicker({minuteStep: 15});
});
</script>
<?php
include ('footer.php');
?>