duancha1065 2017-12-26 10:04
浏览 71
已采纳

状态“付费”时禁用PAY按钮

I want to disable pay button when status paid.

My Code:

<table id="simple-table" class="table  table-bordered table-hover">
    <thead>
        <tr>
            <th width="30%">Month </th>
            <th width="20%">DPS Amount</th>
            <th width="20%">Status</th>
            <th width="30%">Options</th>
        </tr>
    </thead>
    <tbody>
            <?php
                    $acc=$_GET['acc'];
                    $result = $db->prepare("SELECT * FROM dps_schedule WHERE account_number= :userid");
                    $result->bindParam(':userid', $acc);
                    $result->execute();
                    $counter = 0;
                    for($i=0; $row = $result->fetch(); $i++){
            ?>
        <tr class="record">
            <td>Month-<?php echo ++$counter; ?></td>
            <td><?php echo $row['dps_payment']; ?></td>
            <td class="status"><?php echo $row['status']; ?></td>
            <td class="dis"><a rel="facebox" href="dps_installment.php?id=<?php echo $row['id']; ?>"><button class="btn btn-success btn-mini"><i class="icon-edit"></i> PAY </button></a></td>
            </tr>
            <?php
                }
            ?>
    </tbody>
</table> 

Code View:

enter image description here

Now want to disable pay button when status paid.

  • 写回答

3条回答 默认 最新

  • dongmao3148 2017-12-26 10:08
    关注

    You can add if condition like below if you don't want to show Pay Button for Paid Orders :

    <?php if($row['status']!="Paid"){ ?> 
        <td class="dis"><a rel="facebox" href="dps_installment.php?id=<?php echo $row['id']; ?>"><button class="btn btn-success btn-mini"><i class="icon-edit"></i> PAY </button></a></td> 
    <?php } ?>
    

    You can also show the button as Paid and remove the link over it with if else condition like below:

    <?php if($row['status']=="Paid"){ ?> 
        <td class="dis"><button class="btn btn-success btn-mini"><i class="icon-edit"></i> PAID </button></td>
    <?php } else { ?>
        <td class="dis"><a rel="facebox" href="dps_installment.php?id=<?php echo $row['id']; ?>"><button class="btn btn-success btn-mini"><i class="icon-edit">
    </i> PAY </button></a></td> 
    <?php } ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?