用于添加的单选按钮值 [英] radio button value for add

查看:86
本文介绍了用于添加的单选按钮值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 如果(isset($ _ POST)&&( $ _POST ['GET_PAYMENT'] =='1'))
{
$ totalAmount = $ _POST ['GET_PAYMENT']; //总金额
$ checkbox_id = $ _POST ['VALUE']; //单选按钮值

/ *这里从

获取基于$ checkbox_id的数据值(3,5.5或10)并将其存储在$ b $中b
$金额变量* /


$ total_amount = $金额+ $ totalAmount;


Echo $ total_amount;


$ / code>

这是用于我的单选按钮,它具有单独的值点击任何一个按钮,它将与之前的值相加

javascript



Javascript函数

 函数getPaymentVal()
{

Var checkboxVal ='';

checkboxVal = $(input [@ name ='rmr']:checked)。val();

$ .ajax({
type:POST,
url:ajax.php,
data:GET_PAYMENT = 1& VALUE =+ checkboxVal,
成功:函数(total_amount)
{
//将最终值赋给隐藏值
$('#totalamount')。val(total_amount);

//这里改变总金额显示
$('#repair_total_amount')。html(Total&span; span class =repair-finalamount-txt>& pound; & nbsp;+ total_amount +< / span>);

}
});

}


解决方案

它看起来像复制从另一个源代码粘贴这些代码,并且引号会混乱。这取代了

  $。ajax({
类型:POST,
url:ajax。 php,
data:GET_PAYMENT = 1& VALUE =+ checkboxVal,
success:function(total_amount)
{
//将最终值赋给隐藏值
$('#totalamo (total_amount);

//这里改变总金额的显示
$('#repair_total_amount')。html(Total< span class ='repair- finalamount-txt'>& pound;& nbsp;+ total_amount +< / span>);

}
});


Can anyone say if this code is right or wrong?

If(isset($_POST) && ($_POST[‘GET_PAYMENT’] == ‘1’))
{
    $totalAmount = $_POST[‘GET_PAYMENT’]; //Total amount
    $checkbox_id = $_POST[‘VALUE’]; // The radio button value 

    /* Here get the amount values (3,5.5 or 10) from 

    Database based on the $checkbox_id and store it in

    $amount variable*/


    $total_amount = $amount + $totalAmount;


    Echo $total_amount;

}

this is for my radio button which has seperate value when i clicks any one button it will be add with that previous value

javascript

Javascript function

Function getPaymentVal()
{

Var checkboxVal = ‘’;

checkboxVal = $("input[@name=’rmr’]:checked").val();

$.ajax({
   type: "POST",
   url: "ajax.php",
   data: "GET_PAYMENT=1&VALUE="+ checkboxVal,
   success: function(total_amount)
   {
    //Assigning the final value to the hidden value here
    $(‘#totalamount’).val(total_amount);  

    //Here changing the display of total amount
    $(‘#repair_total_amount’).html("Total <span class="repair-finalamount-txt">&pound;&nbsp;"+ total_amount+"</span>");

   }
 });

}

解决方案

It looks like you copy pasted this code from another source and the quotation marks are messed up. Use this instead

$.ajax({
   type: "POST",
   url: "ajax.php",
   data: "GET_PAYMENT=1&VALUE="+ checkboxVal,
   success: function(total_amount)
   {
    //Assigning the final value to the hidden value here
    $('#totalamount').val(total_amount);  

    //Here changing the display of total amount
    $('#repair_total_amount').html("Total <span class='repair-finalamount-txt'>&pound;&nbsp;"+ total_amount+"</span>");

   }
 });

这篇关于用于添加的单选按钮值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆