//Jquery code to send the data with AJAX
$.ajax({
type: "POST",
url: "test.php",
data:
"fname="+ fname +
"& lname="+ lname +
"& address="+ address +
"& city="+ city +
"& state="+ state +
"& zip="+ zip +
"& phone="+ phone +
"& useremail="+ useremail +
//the following values are not being receieved by the php correctly
"& subtotal="+ subTotal +
"& quantity="+ quantity,
success: function(){
$('#oderBtn').hide(function({$('#orderTest').fadeOut();});
}
});
//PHP CODE TO RECEIVE THE AJAX DATA
$fname = htmlspecialchars(trim($_POST['fname']));
$lname = htmlspecialchars(trim($_POST['lname']));
$city = htmlspecialchars(trim($_POST['city']));
$state = htmlspecialchars(trim($_POST['state']));
$zip = htmlspecialchars(trim($_POST['zip']));
$address = htmlspecialchars(trim($_POST['address']));
$email = htmlspecialchars(trim($_POST['useremail']));
//these do not post correctly, i do not know why
$subTotal = htmlspecialchars(trim($_POST['subtotal']));
$quantity = htmlspecialchars(trim($_POST['quantity']));
So the problem is that fname, lname, city, state, zip, address, and email are all working but subtotal, and quantity are not working, firebug has them all POSTing in the same way, it seems like the PHP is just not recieving the data properly.
Adding echo file_get_contents("php://input"); to the php does get everything sent echoed back, including subtotal and quantity but just doing $_POST['subtotal'] will not get the value.
Thanks for any assistance in this matter.
data: { fname: fname, lname: lname, address: address, ... }?