开发者

add the amount for addcart by clicking buttons

I am currently working on my PHP project. In my project I have 4 radio buttons for selecting the method. The four radio buttons have different values. My question is that I think I am confused with the onclick function. I do not know what function I should call.

<input name="rmr" id="rmr" type="radio" value="4" onclick="">
<input name="rmr" id="rmr" type="radio" value="8" onclick="">
<input name="rmr" id="rmr" type="ra开发者_StackOverflowdio" value="12" onclick="">

For example if a customer chooses 3 add cart that total amount value is 22 pounds after that the customer choose that radio button if customer choose 2nd method(radio) button mean that value also add with the add cart and display the total amount like 30 pounds. sorry guys above that code has problem with html tag.

Can anyone help?


<form action="radio.php" method="post">
<input name="rmr" id="rmr" type="radio" value="4" />value 4
<input name="rmr" id="rmr" type="radio" value="8" />value 8
<input name="rmr" id="rmr" type="radio" value="12" />value 12
</form>

<?php

If(isset($_POST['rmr'])) {

$addtocart = $_POST['rmr'];// you will get the radio button value here, if value 4 is selected then the $addtocart value will be 4.

If you want to call a function call it here or you can pass this value to cart.

}


?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜