添加如下几天语句页面变为空白,删除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere)."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."
";
下面列出完整代码
<code> <title>Bob's Auto Parts -Order Result</title> <h1>Bos's Auto Parts</h1> <h2>Order Result</h2> <?php define('TIREPRICE',100); define('OILPRICE',10); define('SPARKPRICE',4); $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; echo " <p>Order processed at".date('H:i, jS F Y').""; echo " <p>Your order is as follow:</p>"; echo $tireqty." tireqty<br>"; echo $oilqty." oilqty<br>"; echo $sparkqty." spark plugs <br>"; $totalqty = 0; $totalqty = $tireqty + $oilqty + $sparkqty; echo "Items ordered: ".$totalqty."<br>"; $totalamount = 0.00; $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; echo "Subtotal: $".number_format($totalamount,2)."<br>"; $taxrate = 0.10; //total sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); echo "Total including tax: $".number_format($totalamount,2)."<br>"</code>
// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";
<code> ?> </code>
添加如下几天语句页面变为空白,删除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere)."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."
";
下面列出完整代码
<code> <title>Bob's Auto Parts -Order Result</title> <h1>Bos's Auto Parts</h1> <h2>Order Result</h2> <?php define('TIREPRICE',100); define('OILPRICE',10); define('SPARKPRICE',4); $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; echo " <p>Order processed at".date('H:i, jS F Y').""; echo " <p>Your order is as follow:</p>"; echo $tireqty." tireqty<br>"; echo $oilqty." oilqty<br>"; echo $sparkqty." spark plugs <br>"; $totalqty = 0; $totalqty = $tireqty + $oilqty + $sparkqty; echo "Items ordered: ".$totalqty."<br>"; $totalamount = 0.00; $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; echo "Subtotal: $".number_format($totalamount,2)."<br>"; $taxrate = 0.10; //total sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); echo "Total including tax: $".number_format($totalamount,2)."<br>"</code>
// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";
<code> ?> </code>
前面的引号类的变量$nothere没有定义会报错,你没有开启debug模式就不会报错,也不会显示
isset和empty返回的都是bool类型,自然是不会显示的
echo "isset($tireqty)"...如果$tireqty没有定义会出错,因为这里双引号里面的isset是作为字符输出的
error_reporting(E_ALL);
ini_set("display_errors", 1);
添加到页面顶端