我有一个很好的表单审查页面:
echo "<div class='reviewItem'><span class='reviewTitle'>Cusomer Name:</span>{$_REQUEST['CustomerName']}</div>";
echo "<div class='reviewItem'><span class='reviewTitle'>Cusomer Email:</span>{$_REQUEST['CustomerEmail']}</div>";
echo "<div class='reviewItem'><span class='reviewTitle'>Customer Phone:</span>{$_REQUEST['CustomerPhone']}</div>";
echo "<div class='reviewItem'><span class='reviewTitle'>Customer Address:</span>{$_REQUEST['CustomerAddress']}</div>";
问题是我有很多字段没有填写。我想在回显之前放一个“if”语句来检查它是否有数据。如果没有,则不会显示任何内容。我对 PHP 很陌生,所以我不确定我是否可以这样称呼:
if (length > 0)echo "<div class='reviewItem'><span class='reviewTitle'>Cusomer Email:</span>{$_REQUEST['CustomerEmail']}</div>";
提前感谢您的帮助。干杯。