ok
Direktori : /proc/thread-self/root/home2/selectio/public_html/lilyexpresslive/software/admin/ |
Current File : //proc/thread-self/root/home2/selectio/public_html/lilyexpresslive/software/admin/branch-edit.php |
<?php require_once('header.php'); ?> <?php if(isset($_POST['form1'])) { $valid = 1; if(empty($_POST['full_name'])) { $valid = 0; $error_message .= 'Name can not be empty<br>'; } if($valid == 1) { $statement = $pdo->prepare("UPDATE tbl_branch SET branch_name=?, email=?, phone=?,address=?, gst_no=?,location=?, status=?,password=?,short_location=? WHERE id=?"); $statement->execute(array($_POST['full_name'],$_POST['email'],$_POST['phone'],$_POST['address'],$_POST['gst_no'],$_POST['location'],$_POST['status'],$_POST['password'],$_POST['short_location'],$_REQUEST['id'])); $success_message = 'Branch is updated successfully!'; } } ?> <?php if(!isset($_REQUEST['id'])) { header('location: logout.php'); exit; } else { // Check the id is valid or not $statement = $pdo->prepare("SELECT * FROM tbl_branch WHERE id=?"); $statement->execute(array($_REQUEST['id'])); $total = $statement->rowCount(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); if( $total == 0 ) { header('location: logout.php'); exit; } } ?> <?php if($_SESSION['lily_express_software_live']['id']==1 || $allPermissions['branch']['update']=="1" ){ ?> <section class="content-header" style="background-color: white;"> <div class="row"> <div class="col-md-8" style="text-align: center;"> <h4><i class="fa fa-user-plus"></i> Edit Branch</h4> </div> <div class="col-md-4"> <a href="branch.php" class="btn btn-danger btn-sm"><i class="fa fa-user-plus"></i> Back to Branch List</a> </div> </div> </section> <?php $statement = $pdo->prepare("SELECT * FROM tbl_branch WHERE id=?"); $statement->execute(array($_REQUEST['id'])); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { $branch_name = $row['branch_name']; $email = $row['email']; $phone = $row['phone']; $address = $row['address']; $status = $row['status']; $password = $row['password']; $gst_no = $row['gst_no']; $short_location = $row['short_location']; $location = $row['location']; } ?> <section class="content" style="background-color: white;"> <div class="row"> <div class="col-md-12"> <?php if($error_message): ?> <div class="callout callout-danger"> <p> <?php echo $error_message; ?> </p> </div> <?php endif; ?> <?php if($success_message): ?> <div class="callout callout-success"> <p><?php echo $success_message; ?></p> </div> <?php endif; ?> <form class="form-horizontal" action="" method="post" enctype="multipart/form-data"> <div > <div class="box-body"> <div class="form-group"> <label for="" class="col-sm-2 control-label">Branch Name <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="full_name" value="<?php echo $branch_name; ?>" required> </div> </div> <div class="form-group" hidden> <label for="" class="col-sm-2 control-label">Email <span></span></label> <div class="col-sm-6"> <input type="text" class="form-control" name="email" value="<?php echo $email; ?>" > </div> </div> <div class="form-group" hidden> <label for="" class="col-sm-2 control-label">Phone Number <span>*</span></label> <div class="col-sm-6"> <input type="text" class="form-control" name="phone" value="<?php echo $phone; ?>" > </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">GST Number <span></span></label> <div class="col-sm-6"> <input type="text" class="form-control" name="gst_no" value="<?php echo $gst_no; ?>" > </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Address <span></span></label> <div class="col-sm-6"> <textarea class="form-control" name="address"><?php echo $address; ?></textarea> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Location <span></span></label> <div class="col-sm-6"> <input type="text" class="form-control" name="location" value="<?php echo $location; ?>" > </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Short Location <span></span></label> <div class="col-sm-6"> <input type="text" class="form-control" name="short_location" value="<?php echo $short_location; ?>" > </div> </div> <div class="form-group" hidden> <label for="" class="col-sm-2 control-label">Password <span>*</span></label> <div class="col-sm-6"> <input type="text" class="form-control" name="password" value="<?php echo $password; ?>" > </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Status <span>*</span></label> <div class="col-sm-6"> <select class="form-control select2" name="status" id="status"> <option value="Active" <?php if(isset($status)) {if($status=='Active'){echo "selected";}} ?>>Active</option> <option value="Inactive" <?php if(isset($status)) {if($status=='Inactive'){echo "selected";}} ?>>Inactive</option> </select> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label"></label> <div class="col-sm-6"> <button type="submit" class="btn btn-success pull-left" name="form1"><i class="fa fa-user-plus"></i> Submit</button> </div> </div> </div> </div> </form> </div> </div> </section> <?php } ?> <?php require_once('footer.php'); ?>