Repository navigation
Expand file tree
/
Copy patheditClient.php
More file actions
184 lines (136 loc) · 5.08 KB
/
Copy patheditClient.php
File metadata and controls
184 lines (136 loc) · 5.08 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
<!DOCTYPE html>
<html>
<head>
<style>
input[type=text], select {
width: 100%;
padding: 10px 13px;
margin: 3px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
.btn{
background-color: #4CAF50;
float: right;
color:white;
text-decoration:none;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Edit Client</title>
<!-- BOOTSTRAP STYLES-->
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<!--CUSTOM BASIC STYLES-->
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/basic.css" rel="stylesheet" />
<!--CUSTOM MAIN STYLES-->
<link href="assets/css/custom.css" rel="stylesheet" />
<!-- GOOGLE FONTS-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
</head>
<body>
<?php include 'header.php';
?>
<!-- /. NAV SIDE -->
<div id="page-wrapper">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Clients Information
<button class="btn" align="center">
<a href="addclient.php" class="btn">Add Client</a>
</button>
</h1>
</div>
</div>
<!-- /. ROW -->
<?php
if($_SERVER["REQUEST_METHOD"] == "GET"){
$client_id = $_GET["client_id"];
}
// checking if agent is authorized to edit or not
$temp_id="";
$master_id="ahmed";
$sql = "SELECT agent_id from client where client_id='$client_id'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
$temp_id= $row['agent_id'];
}
if($_SESSION["username"]==($temp_id || $master_id)){
$sql = "SELECT * from client where client_id='$client_id'";
$result = $conn->query($sql);
echo "<div>\n";
while($row = $result->fetch_assoc()) {
$images = $row["image"];
?>
<img class="profile-user-img img-responsive" width="200px" height="200px" src="<?php echo "../project/uploads/".$images ?>" alt="User profile picture">
<form action="updateClient.php" method="post" enctype="multipart/form-data">
<input type="file" name="fileToUpload"><br>
<?php
echo "<label for=\"fname\">CLIENT ID</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"client_id\" placeholder=\"clients id..\" value=\"$row[client_id]\">";
echo "<label for=\"fname\">CLIENT PASSWORD</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"client_password\" placeholder=\"clients password..\" value=\"$row[client_password]\">";
echo "<label for=\"fname\">NAME</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"name\" placeholder=\"clients name..\" value=\"$row[name]\">";
echo "<label for=\"fname\">GENDER</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"sex\" placeholder=\"clients gender..\" value=\"$row[sex]\">";
echo "<label for=\"fname\">BIRTH DATE</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"birth_date\" placeholder=\"clients Birth Date..\" value=\"$row[birth_date]\">";
echo "<label for=\"fname\">MARITIAL STATUS</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"marital_status\" placeholder=\"clients Maritial Status..\" value=\"$row[marital_status]\">";
echo "<label for=\"fname\">NID</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"nid\" placeholder=\"clients NID..\" value=\"$row[nid]\">";
echo "<label for=\"fname\">PHONE</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"phone\" placeholder=\"clients Phone..\" value=\"$row[phone]\">";
echo "<label for=\"fname\">ADDRESS</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"address\" placeholder=\"clients Address..\" value=\"$row[address]\">";
echo "<label for=\"fname\">POLICY ID</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"policy_id\" placeholder=\"policy id..\" value=\"$row[policy_id]\">";
echo "<label for=\"fname\">AGENT ID</label>";
echo "<input type=\"text\" client_id=\"fname\" name=\"agent_id\" placeholder=\"agent id..\" value=\"$row[agent_id]\">";
?>
<input type="submit" value="UPDATE" name="submit">
</form>
<?php
echo "<a href='deleteClient.php?client_id=".$client_id."'>Delete Client</a>";
echo "</div>\n";
echo "\n";
}
}else{ echo "you are not authorized to edit this client";
}
?>
</div>
<!-- /. PAGE WRAPPER -->
</div>
<!-- /. WRAPPER -->
</body>
</html>