【问题标题】:add the amount for addcart by clicking buttons通过单击按钮为 addcart 添加金额
【发布时间】:2010-12-29 07:56:55
【问题描述】:

我目前正在处理我的 PHP 项目。在我的项目中,我有 4 个单选按钮用于选择方法。四个单选按钮具有不同的值。我的问题是我认为我对 onclick 功能感到困惑。我不知道我应该调用什么函数。

<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="radio" value="12" onclick="">

例如,如果客户选择 3 添加购物车,总金额为 22 磅,然后客户选择该单选按钮如果客户选择第二种方法(单选)按钮意味着该值也与添加购物车一起添加并显示总金额像30磅。 对不起,上面的代码有html标签问题。

谁能帮忙?

【问题讨论】:

    标签: php javascript html css ajax


    【解决方案1】:
    <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.
    
    }
    
    
    ?>
    

    【讨论】:

      猜你喜欢
      • 2011-05-31
      • 2015-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-08
      • 1970-01-01
      • 1970-01-01
      • 2020-10-19
      相关资源
      最近更新 更多