如何禁用超过3天的记录的编辑按钮

时间:2016-06-23 11:45:07

标签: javascript php date

我有一张表格,其中显示了所有日常记录。Table which shows all the daily records

如果记录超过3天,我想禁用编辑按钮。我怎样才能获得这个。我有使用php日期功能的当前日期和3天前的日期。它可以使用PHP或javascript可以使用??

<?php $current_date = date('Y-m-d');// current date
$days_ago = date('Y-m-d', strtotime('-3 days', strtotime($current_date)));
//3 days older date

我正在显示如下记录:

foreach($records as $rec){
 $count = $count+1;
?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo $rec['client_name']; ?></td>
<td><?php echo $rec['address']; ?></td>
<td><?php echo $rec['task']; ?></td>
<td><?php echo $rec['fiber_length']; ?></td>
<td><?php echo $rec['phone_number']; ?></td>
<td><?php echo $rec['package']; ?></td>
<td><?php echo $rec['result']; ?></td>
<td><?php echo $rec['date']; ?></td>
<td><?php echo $rec['team_name']; ?></td>
<td><?php echo $rec['remarks']; ?></td>
<td><a href="<?php echo base_url(); ?>staff_activity/edit_ftth_report/<?php echo $rec['id']?>">Edit</a></td>
 <td><a href="javascript:void(0)" onclick="chk('<?php echo base_url(); ?>staff_activity/delete_ftth_report/<?php echo $rec['id']  ?>')">Delete</a></td>

  </tr>

 <?php

 }?>

1 个答案:

答案 0 :(得分:0)

if(strtotime($current_date) > time()-(60*60*24*3))