我正在尝试创建一个计算器,用户可以在其中输入 4 个值,然后将每个值乘以 0.75,然后相加得到以英镑为单位的价格。
------------我的HTML:----------
<h2>Monthly Fee & transactions Calculator </h2>
<form action="orderprocessing.php" method=post>
<table>
<tr><td>Total of invoices you send to your customers</td>
<td><INPUT type="text" name="customers" size=10 ></td></tr>
<tr><td>Total of invoices you receive from suppliers </td>
<td><INPUT type="text" name="suppliers" size=10 ></td></tr>
<tr><td>Number of lines on your bank statement</td>
<td><INPUT type="text" name="bank" size=10 ></td></tr>
<tr><td>Number of lines on your credit card statement</td>
<td><INPUT type="text" name="creditcard" size=10 ></td></tr>
<tr><td colspan="2"><INPUT TYPE="submit" name="submit"></td></tr>
</table>
</form>
------------我的PHP:----------
结果
<?
echo "<P>Order Processed.";
echo $customers." Total of invoices you send to your customers<BR>";
echo $suppliers." Total of invoices you receive from suppliers<BR>";
echo $bank." Number of lines on your bank statement<BR>";
echo $creditcard." Number of lines on your credit card statement<BR>";
$totalqty = 0;
$totalamount = 0.00;
define("PRICE", 0.75);
$totalqty = $customers + $suppliers + $bank + $creditcard;
$totalamount = $customers * PRICE
+ $suppliers * PRICE
+ $bank * PRICE
+ $creditcard * PRICE;
$totalamount = number_format($totalamount, 2);
echo "<BR>\n";
echo "Items ordered: ".$totalqty."<br>\n;
echo "Subtotal: ".$totalamount."<BR>"\n;
$totalamount = number_format($totalamount, 2);
?>
我有点新手,但它不起作用 - 你能帮忙吗?干杯,斯蒂芬