ok
Direktori : /proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : //proc/thread-self/root/home2/selectio/www/lilyexpresslive/software/admin/logistic-add.php |
<?php require_once('header.php'); ?> <?php if(isset($_POST['form1'])) { // var_dump($_POST); $valid = 1; if(empty($_POST['name'])) { $valid = 0; $error_message .= 'name can not be empty<br>'; } if(empty($_POST['short_name'])) { $valid = 0; $error_message .= 'Short Name can not be empty<br>'; } if(empty($_POST['status'])) { $valid = 0; $error_message .= 'Status can not be empty<br>'; } $code=$_POST['name']; $s_code=$_POST['name']; $statement = $pdo->prepare("SELECT * FROM tbl_logistic where name='$code' and short_name='$s_code'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); if($result) { $valid=0; $error_message .= 'Name or Short Name Alreay Exist<br>'; } if($valid==1) { $statement = $pdo->prepare("INSERT INTO tbl_logistic (name,short_name,status) VALUES (?,?,?)"); $statement->execute(array($_POST['name'],$_POST['short_name'],$_POST['status'])); $success_message = 'Logistic is added successfully!'; unset($_POST); } } ?> <section class="content-header"> <div class="row"> <div class="col-md-2" style="text-align: right;"> <a href="logistics.php" class="btn btn-danger btn-sm"><i class="fa fa-arrow-left"></i> Back to Logistic List</a> </div> <div class="col-md-4" style="text-align: center;"> <h4><i class="fa fa-info-circle"></i> Logistics Details</h4> </div> </div> </section> <section class="content"> <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">Logistic Name <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" placeholder="Enter the Logistic Name" name="name" value="<?php if(isset($_POST['name'])){echo $_POST['name'];} ?>"> </div> </div> <div class="form-group"> <label for="" class="col-sm-2 control-label">Short Name <span>*</span></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" placeholder="Enter the Logistic Short Name" name="short_name" value="<?php if(isset($_POST['short_name'])){echo $_POST['short_name'];} ?>"> </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" name="status"> <?php if(isset($_POST['status'])) { ?> <option value="<?php echo $_POST['status'];?>"><?php echo $_POST['status'];?></option> <?php } ?> <option value="1">Active</option> <option value="0">In-active</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">Submit</button> </div> </div> </div> </div> </form> </div> </div> </section> <?php require_once('footer.php'); ?>