ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/branch-add.php |
<?php require_once('header.php'); ?> <?php if(isset($_POST['add_branch'])) { // var_dump($_POST); $valid = 1; if(empty($_POST['full_name'])) { $valid = 0; $error_message .= 'Name can not be empty<br>'; } if(empty($_POST['location'])) { $valid = 0; $error_message .= 'Location can not be empty<br>'; } if(empty($_POST['status'])) { $valid = 0; $error_message .= 'Status Code can not be empty<br>'; } /*$code=$_POST['phone']; $statement = $pdo->prepare("SELECT * FROM tbl_user where phone='$code'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); //$rows = mysqli_num_rows($result); if($result) { $valid=0; $error_message .= 'Phone No Alreay Exist<br>'; }*/ if($valid==1) { $statement = $pdo->prepare("INSERT INTO tbl_branch (branch_name,email,gst_no,phone,address,location,status,password,short_location,role_type) VALUES (?,?,?,?,?,?,?,?,?,?)"); $statement->execute(array(strtoupper($_POST['full_name']),$_POST['email'],$_POST['gst_no'],$_POST['phone'],$_POST['address'],strtoupper($_POST['location']),$_POST['status'],$_POST['password'],strtoupper($_POST['short_location']),2)); $success_message = 'Branch is added successfully!'; unset($_POST['full_name']); unset($_POST['email']); unset($_POST['gst_no']); unset($_POST['phone']); unset($_POST['address']); unset($_POST['status']); unset($_POST['location']); unset($_POST['password']); unset($_POST['short_location']); } } ?> <?php if($_SESSION['lily_express_software_live']['id']==1 || $allPermissions['branch']['create']=="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> Add 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> <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 if(isset($_POST['full_name'])){echo $_POST['full_name'];} ?>" style="text-transform:uppercase" 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" autocomplete="off" class="form-control" name="email" value="<?php if(isset($_POST['email'])){echo $_POST['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" autocomplete="off" class="form-control" name="phone" value="00000000000" > </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" autocomplete="off" class="form-control" name="gst_no" value="<?php if(isset($_POST['gst_no'])){echo $_POST['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 autocomplete="off" class="form-control" name="address"><?php if(isset($_POST['address'])){echo $_POST['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" autocomplete="off" class="form-control" name="location" value="<?php if(isset($_POST['location'])){echo $_POST['location'];} ?>" style="text-transform:uppercase" required> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Location Shortcode<span></span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="short_location" value="<?php if(isset($_POST['short_location'])){echo $_POST['short_location'];} ?>" style="text-transform:uppercase" required> </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" autocomplete="off" class="form-control" name="password" value="123456" required> </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 >Select Client Status</option>--> <option value="Active" <?php if(isset($_POST['status'])) {if($_POST['status']=='Active'){echo "selected";}} ?>>Active</option> <option value="Inactive" <?php if(isset($_POST['status'])) {if($_POST['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="add_branch"><i class="fa fa-user-plus"></i> Submit</button> </div> </div> </div> </div> </form> </div> </div> </section> <?php } ?> <?php require_once('footer.php'); ?>