-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-edit.php
More file actions
187 lines (119 loc) · 5.08 KB
/
user-edit.php
File metadata and controls
187 lines (119 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
185
186
187
<?php
$title = "Edit User";
include 'template/header.php';
include 'template/top_navbar.php';
include 'template/main_navbar.php';
include 'actions/dbconnection.php';
include "template/notifications.php";
$user_id = $_GET['user_id'];
$find_user_sql = "select * from op_users WHERE USER_ID='".$user_id."'";
$find_user_query = mysqli_query($dbCon,$find_user_sql);
$user = mysqli_fetch_array($find_user_query);
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">Add Users</h1>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-7">
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title">Customer Details</h3>
</div>
<!-- /.card-header -->
<!-- form start -->
<form method="post" action="actions/user_edit.php">
<input type="hidden" name="user_id" value="<?php echo $user['USER_ID']; ?>">
<div class="card-body">
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" name="firstname" value="<?php echo $user['FIRSTNAME']; ?>">
</div>
<div class="form-group">
<label>Last Name</label>
<input type="text" class="form-control" name="lastname" value="<?php echo $user['LASTNAME']; ?>">
</div>
<div class="form-group">
<label>Email Address</label>
<input type="text" class="form-control" name="email" value="<?php echo $user['EMAIL']; ?>">
</div>
<div class="form-group">
<label>Mobile Number</label>
<input type="text" class="form-control" name="mobile" value="<?php echo $user['MOBILE']; ?>">
</div>
<br/>
<hr>
<h4>Login Details</h4>
<div class="form-group">
<label>Username</label>
<input type="text" class="form-control" name="username" value="<?php echo $user['USERNAME']; ?>">
</div>
<div class="form-group">
<label>Access Level</label>
<select class="form-control" name="accessLevel">
<option value="1" <?php if($user['USER_LEVEL']=="1") echo "selected=\"selected\""; ?>><?php echo "Administrator"; ?></option>
<option value="2" <?php if($user['USER_LEVEL']=="2") echo "selected=\"selected\""; ?>><?php echo "Cashier"; ?></option>
</select>
</div>
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="submit" class="btn btn-primary" name="updateUser">Update User</button>
<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#passwordChange">Update Password</button>
<a href="users.php"><button type="button" class="btn btn-default">Back</button></a>
</div>
</form>
</div>
</div>
<!-- Modal -->
<div id="passwordChange" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Change password</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<form action="actions/user_edit.php" method="post">
<input type="hidden" name="user_id" value="<?php echo $user['USER_ID'];?>">
<div class="modal-body">
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" name="password">
</div>
<br/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" name="updatePassword">Update Password</button>
</div>
</form>
</div>
</div>
</div>
<!-- end of modal -->
<div class="col-md-5">
<div class="callout callout-danger">
<h5><strong>Username already exists!</strong></h5>
<p>Username already exists</p>
</div>
</div>
</div><!-- end of div row -->
</div><!--/. container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php include 'template/footer.php'; ?>