123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?php
- require "connectionDb.php";
- if (isset($_POST['edit']) && $_POST['role']!='super' && $_POST['username']!='super' && $_POST['email']!='super' ) {
-
- $role = $_POST['role'];
- $id = $_POST['user_id'];
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $pumplist = $_POST['pumplist'];
- $pumpliststr = implode(",", $pumplist);
-
- $sql ="INSERT INTO user SET created_at=strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),updated_at=strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'), name='$username', email='$email', password='$password',role='$role',pump_list='$pumpliststr' WHERE id='$id'";
- $db->exec($sql);
- echo '<script>window.location.href="index.php"</script>';
- }
-
- ?>
- <style type="text/css">
- .editUserForm {
- display: none;
- }
- input[type=checkbox] {
- position: relative;
- cursor: pointer;
- margin: .4rem;
- }
- input[type=checkbox]:before {
- content: "";
- display: block;
- position: absolute;
- width: 16px;
- height: 16px;
- top: 0;
- left: 0;
- border: 2px solid #555555;
- border-radius: 3px;
- background-color: white;
- }
- input[type=checkbox]:checked:after {
- content: "";
- display: block;
- width: 5px;
- height: 10px;
- border: solid black;
- border-width: 0 2px 2px 0;
- -webkit-transform: rotate(45deg);
- -ms-transform: rotate(45deg);
- transform: rotate(45deg);
- position: absolute;
- top: 2px;
- left: 6px;
- }
- </style>
- <div class="container editUserForm" id="editUserForm">
- <form class="form-horizontal" action="" method="post">
- <input type="number" name="user_id" id="id" hidden="true">
- <div class="form-group">
- <label class="control-label col-sm-2"> Name </label>
- <div class="col-sm-10">
- <input id="username" type="text" name="username">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-2"> Role </label>
- <div class="col-sm-4">
-
- <select class="col-sm-6" id="role" name="role">
- <option value="cashier">cashier</option>
- <option value="user">user</option>
- <option value="supervisor">supervisor</option>
- <option value="super">super</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-2"> Email </label>
- <div class="col-sm-10">
- <input id="email" type="text" name="email" disabled="true">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-2"> Password </label>
- <div class="col-sm-10">
- <input id="password" type="text" name="password" disabled="true">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-2"> POS passcode </label>
- <div class="col-sm-10">
- <input id="passcode" type="text" name="passcode" disabled="true">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-2"> Pump List </label>
- <div class="col-sm-10">
- <!-- <input id="pumplist1" type="checkbox" name="pumplist" value="1"> 1
- <input id="pumplist" type="checkbox" name="pumplist" value="2"> 2 -->
- <?php
- for($i=1;$i<=24;$i++){
- echo ' <input id="pumplist'.$i.'" type="checkbox" name="pumplist[]" value="'.$i.'"> '.$i;
- if ($i==12) {
- echo "<br>";
- }
- }
- ?>
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <input type="submit" name="edit" value="Submit" class="btn btn-success">
- <input type="button" value="Cancel" class="btn btn-danger" onclick="document.getElementById('editVForm').style.display = 'none';">
- </div>
- </div>
- </form>
- </div>
|