I have written this code for add cart to payment. while clicking buttons that cart will be add. but I got undefined syntax error
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;
}
I got the error on above the page also I got a error in JS function
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)
{
$(‘#totalamount’).val(total_amount);
$(‘#repair_total_amount’).html(“Total <span class="repair-finalamount-txt">£ ”+ total_amount+”</span>”);
$(function() {
$("input[name='rmr']").change(function() {
var val = parseInt($(this).val(), 10) ;
alert("Typeof val: " + typeof(val));
});
});
Can anyone re-correct my code?
Check if all your brakets match, uncomment parts of the code where you think that there might be an error. Put parts of the code back in, until you notice that the error occurs. The latest added part of the code is the area where the error occurs.
This is the ways of the debugging jedi. May the force be with you.
write your ‘if’ statement in small letters, ‘function’ as well, as well as ‘var’, same goes for ‘echo’.