【发布时间】:2011-08-25 13:00:13
【问题描述】:
<?php
$tireqty = $_POST['tireqty'];
$oilqty = $_POST['oilqty'];
$sparkqty = $_POST['sparkqty'];
$totalamount = 0.00;
define('TIREPRICE', 100);
define('OILPRICE', 10);
define('SPARKPRICE', 4);
$totalqty = 0;
$totalqty = $tireqty + $oilqty + $sparkqty;
i f ($totalqty == 0) {
echo "You did not enter anything in the boxes on the previous page.";
}
else {
echo "<p>Order processed at ".date('H:i, jS F Y')."</p><br /><br />";
echo '<p>Your order is as follows:</p>';
echo $tireqty.' tires<br />';
echo $oilqty.' bottles of oil<br />';
echo $sparkqty.' spark plugs<br />';
echo "Items ordered: ".$totalqty."<br />";
if ($tireqty < 10) {
$discount = 0;
}
elseif ($tireqty >= 10) && ($tireqty <= 49) {
$discount = 0.05;
}
elseif ($tireqty >= 50) && ($tireqty <= 99) {
$discount = 0.10;
}
elseif ($tireqty >= 100) {
$discount = 0.15;
}
$totalamount = ($tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE) * (1+$discount);
echo "Subtotal (Discount applied here): $".number_format($totalamount, 2)."<br />";
$taxrate = 0.10;
$totalamount = $totalamount * (1+ $taxrate);
echo "Total including Tax: $".number_format($totalamount,2)."<br />";
}
?>
任何帮助将不胜感激。
【问题讨论】:
-
发布您遇到的错误
-
不工作,我们的工作是找出原因和原因。有趣的态度。
-
抱歉,我收到:“服务器错误网站在检索 localhost/processorder.php 时遇到错误。它可能因维护而关闭或配置不正确。”在铬。我对 PHP 很陌生,所以我不确定如何设置错误报告...
-
我马上看到一件事:第一个中的一堆空格 if: i f ($totalqty == 0) {
-
另外,如果你不知道如何编辑你的配置文件,这里是如何通过代码打开错误报告:php.net/manual/en/function.error-reporting.php
标签: php