1

$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 }?>

我已经使用了一些代码,但仍然无法正常工作。

4

1 回答 1

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 }?>

代码现在将只执行$statusis not的这一位'Delivered'

于 2013-11-04T02:04:26.703 回答