-
Notifications
You must be signed in to change notification settings - Fork 13
/
edit_customer.php
239 lines (167 loc) · 6.66 KB
/
edit_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
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
<?php
/* Avoid multiple sessions warning
Check if session is set before starting a new one. */
if(!isset($_SESSION))
{
session_start();
}
include "validate_admin.php";
include "connect.php";
include "header.php";
include "user_navbar.php";
include "admin_sidebar.php";
include "session_timeout.php";
if (isset($_GET['cust_id'])) {
$_SESSION['cust_id'] = $_GET['cust_id'];
}
$sql0 = "SELECT * FROM customer WHERE cust_id=".$_SESSION['cust_id'];
$sql1 = "SELECT * FROM passbook".$_SESSION['cust_id']." WHERE trans_id=(
SELECT MAX(trans_id) FROM passbook".$_SESSION['cust_id'].")";
$result0 = $conn->query($sql0);
$result1 = $conn->query($sql1);
if ($result0->num_rows > 0) {
// output data of each row
while($row = $result0->fetch_assoc()) {
$fname = $row["first_name"];
$lname = $row["last_name"];
$gender = $row["gender"];
$dob = $row["dob"];
$aadhar = $row["aadhar_no"];
$email = $row["email"];
$phno = $row["phone_no"];
$address = $row["address"];
$branch = $row["branch"];
$acno = $row["account_no"];
$pin = $row["pin"];
$cus_uname = $row["uname"];
$cus_pwd = $row["pwd"];
}
}
if ($result1->num_rows > 0) {
// output data of each row
while($row = $result1->fetch_assoc()) {
$balance = $row["balance"];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="customer_add_style.css">
</head>
<body>
<form class="add_customer_form" action="edit_customer_action.php" method="post">
<div class="flex-container-form_header">
<h1 id="form_header">Edit/View Customer details . . .</h1>
</div>
<div class="flex-container">
<div class=container>
<label>Customer ID : <label id="info_label">
<?php echo $_SESSION['cust_id'] ?> </label></label>
</div>
</div>
<div class="flex-container">
<div class=container>
<label>First Name :</label><br>
<input name="fname" size="30"
type="text" value="<?php echo $fname ?>" required />
</div>
<div class=container>
<label>Last Name :</b></label><br>
<input name="lname" size="30" type="text" value="<?php echo $lname ?>" required />
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Balance (INR) : <label id="info_label"> <?php echo number_format($balance) ?> </label></label>
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Gender :
<label id="info_label">
<?php
if ($gender == "male") {echo "Male";}
elseif ($gender == "female") {echo "Female";}
else {echo "Others";}
?>
<label>
</label>
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Date of Birth :</label><br>
<input name="dob" size="30" type="text" placeholder="yyyy-mm-dd" value="<?php echo $dob ?>" required />
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Aadhar No :</label><br>
<input name="aadhar" size="25" type="text" value="<?php echo $aadhar ?>" required />
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Email-ID :</label><br>
<input name="email" size="30" type="text" value="<?php echo $email ?>" required />
</div>
<div class=container>
<label>Phone No. :</b></label><br>
<input name="phno" size="30" type="text" value="<?php echo $phno ?>" required />
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Address :</label><br>
<textarea name="address" required /><?php echo $address ?></textarea>
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Bank Branch :</label>
</div>
<div class=container>
<select name="branch">
<option value="SHIVAMOGA" <?php if ($branch == 'SHIVAMOGA') {?> selected="selected" <?php }?>>SHIVAMOGA</option>
<option value="BANGALORE" <?php if ($branch == 'BANGALORE') {?> selected="selected" <?php }?>>BANGALORE</option>
<option value="CHITRADURGA" <?php if ($branch == 'CHITRADURGA') {?> selected="selected" <?php }?>>CHITRDURGA</option>
<option value="BHADRAVATHI" <?php if ($branch == 'BHADRAVATHI') {?> selected="selected" <?php }?>>BHADRAVATHI</option>
<option value="MYSORE" <?php if ($branch == 'MYSORE') {?> selected="selected" <?php }?>>MYSORE</option>
</select>
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Account No :</label><br>
<input name="acno" size="25" type="text" value="<?php echo $acno ?>" required />
</div>
</div>
<div class="flex-container">
<div class=container>
<label>PIN(4 digit) :</b></label><br>
<input name="pin" size="15" type="text" value="<?php echo $pin ?>" required />
</div>
</div>
<div class="flex-container">
<div class=container>
<label>Username :</label><br>
<input name="cus_uname" size="30" type="text" value="<?php echo $cus_uname ?>" required />
</div>
<div class=container>
<label>Password :</b></label><br>
<input name="cus_pwd" size="30" type="text" value="<?php echo $cus_pwd ?>" required />
</div>
</div>
<div class="flex-container">
<div class="container">
<a href="manage_customers.php" class="button">Go Back</a>
</div>
<div class="container">
<button type="submit">Update</button>
</div>
</div>
</form>
</body>
</html>