Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you tried using <code>$_GET[]</code> rather than <code>$_POST[]</code>? That would be the first thing I'd try, since <code>$_GET</code> is designed for getting data from a URL, whereas <code>$_POST</code> is designed more for getting data passed in from a form submit.</p> <pre><code>$fname = htmlspecialchars(trim($_GET['fname'])); $lname = htmlspecialchars(trim($_GET['lname'])); $city = htmlspecialchars(trim($_GET['city'])); $state = htmlspecialchars(trim($_GET['state'])); $zip = htmlspecialchars(trim($_GET['zip'])); $address = htmlspecialchars(trim($_GET['address'])); $email = htmlspecialchars(trim($_GET['useremail'])); $subTotal = htmlspecialchars(trim($_GET['subtotal'])); $quantity = htmlspecialchars(trim($_GET['quantity'])); </code></pre> <p>An example of this output as a JSON array:</p> <pre><code>$data = array( 'fname' =&gt; htmlspecialchars(trim($_GET['fname'])); 'lname' =&gt; htmlspecialchars(trim($_GET['lname'])); 'city' =&gt; htmlspecialchars(trim($_GET['city'])); 'state' =&gt; htmlspecialchars(trim($_GET['state'])); 'zip' =&gt; htmlspecialchars(trim($_GET['zip'])); 'address' =&gt; htmlspecialchars(trim($_GET['address'])); 'email' =&gt; htmlspecialchars(trim($_GET['useremail'])); 'subTotal' =&gt; htmlspecialchars(trim($_GET['subtotal'])); 'quantity' =&gt; htmlspecialchars(trim($_GET['quantity'])); ); echo json_encode($data); </code></pre> <p><strong>EDIT:</strong></p> <p>You may also need to use <code>encodeURI()</code> in your jQuery to ensure that no ampersands or other characters mess up the URL string.</p> <pre><code>$.ajax({ type: "GET", url: "test.php", data: encodeURI( "?fname=" + fname + "&amp;lname=" + lname + "&amp;address=" + address + "&amp;city=" + city + "&amp;state=" + state + "&amp;zip=" + zip + "&amp;phone=" + phone + "&amp;useremail=" + useremail + "&amp;subtotal=" + subTotal + "&amp;quantity=" + quantity ), success: function(response){ alert(response); // Will show the JSON array $('#oderBtn').hide(function({$('#orderTest').fadeOut();}); } }); </code></pre> <p>Fiddle: <a href="http://jsfiddle.net/xNSLX/" rel="nofollow">http://jsfiddle.net/xNSLX/</a></p>
    singulars
    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.
    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