语句为TRUE时隐藏列

时间:2013-11-04 01:56:25

标签: php html

如果变量$status等于'Delivered',我该如何隐藏此行?

<?php if ($status == 'Delivered') { ?>
<tr>
    <td class="normalfont" >Reason for failed delivery:</td>
    <td><input type="text"
        STYLE="color: #0000; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #E1E5E6;"
        size="50" class="frmSearch" name="courier_del_reason"
        readonly="readonly"
        value="<?=$objResult["courier_del_reason"];?>" /></td>
</tr>
<?php }?>

我使用了一些代码,但它仍无效。

1 个答案:

答案 0 :(得分:2)

我希望通过列,你的意思是表行(给定的是你给出的代码所做的),在这种情况下,它是条件的简单改变:

<?php if ($status != 'Delivered') { ?>
              //  ^ This bit was changed.
<tr>
    <td class="normalfont" STYLE="font-family: Verdana;">Reason for failed delivery:</td>
    <td><input type="text"
        STYLE="color: #0000; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #E1E5E6;"
        size="50" class="frmSearch" name="courier_del_reason"
        readonly="readonly"
        value="<?=$objResult["courier_del_reason"];?>" /></td>
</tr>
<?php }?>

现在代码只会执行$status的值'Delivered'不是{{1}}。

相关问题