Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
228 views
in Technique[技术] by (71.8m points)

php - radio button value for add

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>”);

   }
 });

}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Look at this code, I think it's possible because of the " and ' characters which is pasted poorly from another different-character-encoding source. You should type it again to see if the errors happen.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...