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">£ ”+ total_amount+”</span>”);
}
});
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…