ok
Direktori : /home2/selectio/www/mm-tailor-billing/hrm/ |
Current File : /home2/selectio/www/mm-tailor-billing/hrm/users-edit.php |
<?php include "header.php"; if(isset($_POST['update'])){ try{ $statement = $pdo->prepare("UPDATE tec_users SET user_type=?, hrms=?, order_no=?,status=?, `per_day_salary`=?, `ot_amount`=? WHERE id=?"); $result=$statement->execute(array($_POST['users_type'],$_POST['hrms'],$_POST['order_no'],$_POST['status'],$_POST['per_day_salary'], $_POST['ot_amount'], $_POST['ids'])); if($result){ $_SESSION['message'] = "User Details is Updated Successfully"; header("location: users.php"); /*$message = 'Customer Details is updated successfully!'; unset($_POST); */ }else{ $warning="Something went wrong try again..."; } }catch(Exception $e){ $error=$e; } } $ids=$_GET['id']; $statement = $pdo->prepare("SELECT * FROM tec_users e where e.id=".$ids); $statement->execute(); $emp_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); if($totalData==1){ ?> <div class="content-wrapper" style="background:white;"> <section class="content-header"> <h4><b>Update Users Details</b></h4> <ol class="breadcrumb"> <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active">Update Users Details</li> </ol> </section> <section class="content"> <div class="row"> <div class="col-xs-12"> <div> <div class="box-body"> <div class="col-lg-12 alerts"><br> <div id="custom-alerts" style="display:none;"> <div class="alert alert-dismissable"> <div class="custom-msg"></div> </div> </div> <?php if ($error) { ?> <div class="alert alert-danger alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-ban"></i> Error</h4> <?= $error; ?> </div> <?php $error=0;} if ($warning) { ?> <div class="alert alert-warning alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-warning"></i> Warning</h4> <?= $warning; ?> </div> <?php $warning=0;} if ($message) { ?> <div class="alert alert-success alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4> <i class="icon fa fa-check"></i> Success</h4> <?= $message; ?> </div> <?php $message=0; } ?> </div> <div class="clearfix"></div> <div class="col-lg-12"> <form action="" class="validation" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <?php foreach($emp_data as $data){ ?> <input type="hidden" name="ids" value="<?=$emp_data[0]['id']?>" class="form-control tip" id="id" required="required" /> <h3><b>User Name: <?=$emp_data[0]['first_name']?></b></h3> <div class="row"> <div class="col-md-3"> <div class="form-group"> <label class="required" for="users_type">User Type</label> <select name="users_type" class="form-control select2" id="users_type" required="required"> <option value="None" <?php if($emp_data[0]['user_type']=="None"){echo "selected";}?>>None</option> <option value="General" <?php if($emp_data[0]['user_type']=="General"){echo "selected";}?>>General</option> <option value="Cutting" <?php if($emp_data[0]['user_type']=="Cutting"){echo "selected";}?>>Cutting</option> <option value="Stitching" <?php if($emp_data[0]['user_type']=="Stitching"){echo "selected";}?>>Stitching</option> </select> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="hrms">HRMS</label> <select name="hrms" class="form-control select2" id="hrms" required="required"> <option value="Default" <?php if($emp_data[0]['hrms']=="Default"){echo "selected";}?>>Default</option> <option value="HRMS" <?php if($emp_data[0]['hrms']=="HRMS"){echo "selected";}?>>HRMS</option> </select> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Order Number</label> <input name="order_no" class="form-control order_no" value="<?=$emp_data[0]['order_no']?>" style="width:100%" id="order_no" required> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>Per Day Salary</label> <input name="per_day_salary" class="form-control per_day_salary" value="<?=$emp_data[0]['per_day_salary']?>" style="width:100%" id="per_day_salary" required> </div> </div> <div class="col-md-3"> <div class="form-group"> <label>OT Amount</label> <input name="ot_amount" class="form-control ot_amount" value="<?=$emp_data[0]['ot_amount']?>" style="width:100%" id="ot_amount" required> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="required" for="status">Status</label> <select name="status" class="form-control select2" id="status" required="required"> <option value="1" <?php if($emp_data[0]['status']=="1"){echo "selected";}?>>Active</option> <option value="0" <?php if($emp_data[0]['status']=="0"){echo "selected";}?>>In-Active</option> </select> </div> </div> <?php } ?> </div> <div class="row"> <div class="form-group" style="text-align:center;"> <input type="submit" name="update" value="Update Users Details" class="btn btn-success" /> </form> </div> </div> <div class="form-group" style="text-align:center;"> <?php echo "<a href=users-edit.php?id=".$ids."> <button class='btn btn-primary' > <i class='fa fa-refresh'></i> Reset Form</button></a>"; ?> <a href="users.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <?php } include "footer.php";?>