如何在单击CODEIGNITER后禁用当天的按钮?

时间:2015-10-09 07:11:28

标签: php codeigniter

这是我尝试过的代码。通过检查数据库禁用按钮似乎不起作用。如果有其他方法可以禁用一天的按钮,请告诉我。提前谢谢。

签入和签出是表格中名为checktime的列。     

<?php $time=date('Hi'); ?>

 <body class='wrapper'>
<?php
$curdatein = $this->db->query("SELECT * FROM `checktime` WHERE DATE_FORMAT(checkin, '%m%d%Y') = DATE_FORMAT(NOW(), '%m%d%Y')");
$curdateout = $this->db->query("SELECT * FROM `checktime` WHERE DATE_FORMAT(checkout, '%m%d%Y') = DATE_FORMAT(NOW(), '%m%d%Y')");
//echo $curdatein;
//echo $curdateout;
if (($curdatein !='') && ($curdateout !=''))
{ ?>
<a href ="<?php echo base_url("index.php/User_controller/checkintime"); ?>">
<input type='button' id='bind'value='Check IN' name='intimebtn' class='btn btn-primary btn-md' disabled >


</a>
<a href ="<?php echo base_url("index.php/User_controller/checkouttime"); ?>">
   <input type='button' id ='unbind' value='Check Out' name='outtimebtn' class='btn btn-primary btn-md' disabled ></a>



 <?php } else { ?>
 <div class="loginform">
<?php if (($time >=0800) && ($time <=1200))  {?>
<a href ="<?php echo base_url("index.php/User_controller/checkintime"); ?>">
<input type='button' id='bind'value='Check IN' name='intimebtn' class='btn btn-primary btn-md' >
<script>

   </a>
 <a href ="<?php echo base_url("index.php/User_controller/checkouttime"); ?>">
     <input type='button' id ='unbind' value='Check Out' name='outtimebtn' class='btn btn-primary btn-md' disabled ></a>


     <?php 
       }
    else if (($time >=1600) && ($time <=2100))
     { ?>
      <a href ="<?php echo base_url("index.php/User_controller/checkintime"); ?>">
     <input type='button' id='bind'value='Check IN' name='intimebtn' class='btn btn-primary btn-md'  disabled >
    </a>
    <a href ="<?php echo base_url("index.php/User_controller/checkouttime"); ?>">
        <input type='button' id ='unbind' value='Check Out' name='outtimebtn' class='btn btn-primary btn-md' onClick="this.disabled=true;" >
    </a>
       <?php
     }

     else {
?>
         <a href ="<?php echo base_url("index.php/User_controller/checkintime"); ?>">
          <input type='button' id='bind'value='Check IN' name='intimebtn' class='btn btn-primary btn-md' disabled>
           </a>
        <a href ="<?php echo base_url("index.php/User_controller/checkouttime"); ?>">
          <input type='button' id ='unbind' value='Check Out' name='outtimebtn' class='btn btn-primary btn-md' disabled >
        <?php } }?>
       </a>
        <a href ="<?php echo base_url("index.php/User_controller/getdetails"); ?>">
        <input type='button' id ='unbind' value='Get User Details' name='getDetails' class='btn btn-primary btn-md'  >


   </a>
    </div>
    </body>
     </html>

0 个答案:

没有答案