Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery post to php file works but can only return some data when echoed in PHP
    primarykey
    data
    text
    <p>//Jquery code to send the data with AJAX</p> <pre><code> $.ajax({ type: "POST", url: "test.php", data: "fname="+ fname + "&amp;amp; lname="+ lname + "&amp;amp; address="+ address + "&amp;amp; city="+ city + "&amp;amp; state="+ state + "&amp;amp; zip="+ zip + "&amp;amp; phone="+ phone + "&amp;amp; useremail="+ useremail + //the following values are not being receieved by the php correctly "&amp;amp; subtotal="+ subTotal + "&amp;amp; quantity="+ quantity, success: function(){ $('#oderBtn').hide(function({$('#orderTest').fadeOut();}); } }); </code></pre> <p>//PHP CODE TO RECEIVE THE AJAX DATA</p> <pre><code>$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'])); </code></pre> <p>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.</p> <p>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.</p> <p>Thanks for any assistance in this matter.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload