ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/obnovit-tracking/old/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/obnovit-tracking/old/common-leave.php

<?php  include "header.php";

if(isset($_POST['update_common_leave'])){
        try{
            
            $monday=isset($_POST['Monday']) ? 1 : 0;
            $tuesday=isset($_POST['Tuesday']) ? 1 : 0;
            $wednesday=isset($_POST['Wednesday']) ? 1 : 0;
            $thursday=isset($_POST['Thursday']) ? 1 : 0;
            $friday=isset($_POST['Friday']) ? 1 : 0;
            $saturday=isset($_POST['Saturday']) ? 1 : 0;
            $sunday=isset($_POST['Sunday']) ? 1 : 0;
            
        $statement = $pdo->prepare("UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 1; 
        UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 2;
        UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 3;
        UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 4;
        UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 5;
        UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 6;
        UPDATE `tbl_comon_leave` SET `status` = ? WHERE `tbl_comon_leave`.`id` = 7;");
        $result=$statement->execute(array($monday,$tuesday,$wednesday,$thursday,$friday,$saturday,$sunday));
                    
                    if($result){
                        $message = 'Common Leave Information Updated successfully!';
                        unset($_POST);      
                    }else{
                        $warning="Something went wrong try again...";
                    }  
                }catch(Exception $e){
                    $error=$e;
                }   
    }
    
?>



?>
<div class="content-wrapper" style="background:white;">
        <div class="col-lg-12 alerts">
            <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>







<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-header">
                    <h3 class="box-title"><b><i class="fa fa-edit"></i> Update Common Leave Information : </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">

                        <form action="" class="validation" enctype="multipart/form-data" method="post" accept-charset="utf-8">
                                                                 
                        <div class="row">
                            <div class="col-md-6" style="text-align: right;">
                                <div class="form-group">
                                    <label style="color: green;" for="category">------------------<br>Days<br>------------------</label>                                    
                                </div>
                            </div>
                             <div class="col-md-6">
                                <div class="form-group">
                                    <label style="color: green;" for="category">------------------------------------------------------------------------<br>Note : If Leave Click Check Box else leave it..<br>------------------------------------------------------------------------</label>                                    
                                </div>
                            </div>
                            
 <?php
 $statement = $pdo->prepare("SELECT * FROM tbl_comon_leave");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $com_leave){
 ?>                           
 <div class="row">                           
                            <div class="col-md-6" style="text-align: right;">
                                <div class="form-group">
                                    <label  for="category"><?=$com_leave['day_name']?></label>                                    
                                </div>
                            </div>
                             <div class="col-md-6">
                                <div class="form-group">
                                    <input type="checkbox"  style="width:35%;"  value="0" name="<?=$com_leave['day_name']?>" <?php if($com_leave['status']=="1"){ echo"checked"; }?>>                                    
                                </div>
                            </div>
</div>
<?php  } ?>                            
                            
                        </div>
                        

                        <div class="form-group" style="text-align:center;">
                            <input type="submit" name="update_common_leave" value="Update Common Leave"  class="btn btn-success" />
                        </form>
                        </div>

                    </div>
                        <div class="form-group" style="text-align:center;">
                            <a href="common-leave.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
                            <a href="index.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to Dashboard</button></a>
                         </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>


<?php include "footer.php";?>

Zerion Mini Shell 1.0