我有这样的价格表。所有的东西都在工作,但我无法在下一页显示总价。
<!-- packs -->
<div class="packs" >
<div class="item" id="packs-1" rel='1'
data-commission='2' data-price='10'>
<span>10 usd</span>
</div>
<div class="item" id="packs-2" rel='2'
data-commission='3' data-price='25'>
<span>25 usd</span>
</div>
<div class="item" id="packs-3" rel='3'
data-commission='4' data-price='50'>
<span>50 usd</span>
</div>
<div class="item" id="packs-4" rel='4'
data-commission='4' data-price='100'>
<span>100 usd</span>
</div>
<div class="item" id="packs-8" rel='8'
data-commission='4' data-price='250'>
<span>250 usd</span>
</div>
<div class="item" id="packs-12" rel='12'
data-commission='5' data-price='500'>
<span>500 usd</span>
</div>
<div class="total">
<span>Main Price : <b class="mainprice" id='mainprice'>0 usd</b></span>
<span>Tax Price : <b class="taxes" id='taxes'>0 usd</b></span>
<span class="Total" >Total Price: <b class="Total" id='Total' >0 usd</b></span>
</div>
</div>
这是我想要的例子。
<div class="total">
<span>Main Price : <b class="mainprice" id='mainprice'>25 usd (total price selected) </b></span>
<span>Tax Price : <b class="taxes" id='taxes'>2 usd (automatic calculated tax 2 usd) </b></span>
<span class="Total" >Total Price: <b class="Total" id='Total' >27 usd (that is total price)</b></span>
</div>
表格和税金计算非常有效。我的问题是如何传递27美元的值传递回显另一页?
这是我的计算代码
<script>
$(".item").click(function() {
var price = parseFloat($(this).attr('data-price'));
var commission = parseFloat($(this).attr('data-commission'));
var total = parseFloat(price) + parseFloat(commission);
$("form[name='payment-form'] input.vds-products").val($(this).attr('rel'));
$("#mainprice").html(price + ' usd');
$("#taxes").html(commission + ' usd');
$("#Total").html(total + ' usd');
});
这是所有php full 3文件。 Dropbox full php files
答案 0 :(得分:0)
您可以通过链接传递它,并在另一页上使用get方法获得总价,例如此处Pass variable using php url
答案 1 :(得分:0)
为什么要记笔记使用会话(这是我个人的决定),还是要通过请求后将总数传递到下一页?注意:通过post或get传递var是危险的,可以对其进行操作。但是没有人能够触摸$ _SESSION变量。