-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_customer.php
161 lines (109 loc) · 3.4 KB
/
update_customer.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
<?php
include 'adminheader.php'
?>
<!-- Main containt -->
<div class="container">
<div class="main">
<?php
include_once("Config.php");
$res = $pro->findOne(array('Customer.U_name' => $_GET['username']));
//echo "<h1><p style='color:#000099; font-size=50px'> Hello ".$res['Customer']['F_name']." ".$res['Customer']['L_name']."</p></h1><br>";
?>
<form method="post">
<table class="table" border="0">
<tbody>
<tr>
<td>Firstname :</td>
<td><input type="text" name="F_name" value="<?php echo $res['Customer']['F_name']; ?>"></td>
</tr>
<tr>
<td>Lastname :</td>
<td><input type="text" name="L_name" value="<?php echo $res['Customer']['L_name']; ?>"></td>
</tr>
<tr>
<td>User Name :</td>
<td><?php echo $res['Customer']['U_name']; ?></td>
</tr>
<tr>
<td>Contact Number :</td>
<td><input type="number" name="M_number" maxlength="10" minlength="10" value="<?php echo $res['Customer']['M_number']; ?>"></td>
</tr>
<tr>
<td>Email :</td>
<td><input type="email" name="email" value="<?php echo $res['Customer']['email']; ?>"></td>
</tr>
<tr>
<td>Address :</td>
<td><textarea minlength=20 name="address"><?php echo $res['Customer']['address']; ?> </textarea></td>
</tr>
<?php
if($_GET['from']=='profile')
{
?>
<tr>
<td>Pending Amount :</td>
<td>
<?php
if($res['Customer']['U_name']=="admin")
{
?>
<input type="text" name="P_amt" value=<?php echo $res['Customer']['P_amt']; ?>></td>
<?php
}
else {
echo $res['Customer']['P_amt'];
}
?>
</tr>
<?php
}
else if($_GET['from']=='admin') {
?>
<tr>
<td>Pending Amount :</td>
<td><input type="text" name="P_amt" value=<?php echo $res['Customer']['P_amt']; ?>></td>
</tr>
<?php
}
?>
</tbody>
</table>
<center>
<input class="btn btn-info btn-lg" type="submit" name="update" value="Save" >
<?php
if($_GET['from']=='admin')
{
?>
<a class="btn btn-info btn-lg" href="all_customers.php" > Cancel </a> </center>
<?php
}
else if($_GET['from']=='profile')
{
?>
<a class="btn btn-info btn-lg" href="Customer_Pro.php" > Cancel </a> </center>
<?php
}
?>
</form>
</div>
</div>
<?php
if(isset($_POST["update"]))
{
$res = $pro->update(array('Customer.U_name' =>$_GET['username']),array('$set'=>array('Customer.F_name' => $_POST['F_name'], 'Customer.L_name' =>$_POST['L_name'],'Customer.M_number' => $_POST['M_number'],'Customer.email' => $_POST['email'],'Customer.address' => $_POST['address'])));
if($res)
{
if($_GET['from']=='profile')
{
echo "<script type='text/javascript'>alert('Your details are updated !'); window.location.href='Customer_Pro.php';</script>";
}
else if($_GET['from']=='admin')
{
echo "<script type='text/javascript'>alert('Your details are updated !'); window.location.href='all_customers.php';</script>";
// header("Location: dashboard.php");
}
}
}
include 'footer.php';
?>
</div>