이 코드가 옳은지, 아니면 잘못 되었 니?추가 할 라디오 버튼 값
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;
}
이 내가이 될 것입니다 어느 하나 개의 버튼이 그 이전 값
자바 스크립트
자바 스크립트 기능
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>”);
}
});
}
정상적으로'data : {GET_PAYMENT : 1, VALUE : checkboxVal} '을 사용하는 것을 제외하고는 괜찮습니다. 또한 이러한 msword-type 따옴표가 작동 할 수도 있습니다. 당신이 얻는 결과는 무엇입니까? –
가 동의합니다. 꽤 확실한 '과'는 코드를 망칠 것입니다. 대신 '사용해야합니다. – dqhendricks