html页面在action中提交给了php页面,如何访问这个html页面,可以在php中获取页面的值
2个回答
展开全部
<td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"></td></tr><tr><td colspan="2" align="center"><input type="submit" value="Submit Order"></td></tr></table></form>php页面代码:<?php//创建三个对象来接收页面上传过来的值
$tireqty = $_POST['tireqty'];
$oilqty = $_POST['oilqty'];
$sparkqty = $_POST['sparkqty'];
//声明并初始化三个常量用来计划订购商品的总金额
define('TIREPRICE',100);
define('OILPRICE',10);
define('SPARKPRICE',4);
//创建两个变量来保存订购商品的总数和总金额
$totalqty = $tireqty + $oilqty +$sparkqty;
echo 'Items ordered: '.$totalqty.'<br />';
$totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE;
echo 'Subtotal: $'.number_format($totalamount,2).'<br />';
//声明并初始化税金变量
$taxrate = 0.10;
$totalamount =$totalamount *(1+$taxrate);
echo 'Total including tax:$'.number_format($totalamount,2).'<br />';
echo '<p>Your order is as follows:</p>';
echo $tireqty.' tires<br />';
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询