title: using json to update mysql database blank fields
body: <p>I'm trying to insert records into a mysql db but the fields are blank. Here is my js:</p>
  
  <pre><code>$("#submit").click(function() { 
      var product1name     = $("input#product1name").val();
      var product2name     = $("input#product2name").val();
      var product3name     = $("input#product3name").val();
      var product4name     = $("input#product4name").val();
      var product5name     = $("input#product5name").val();
      var product1quantity = $("input#product1quantity").val();
      var product2quantity = $("input#product2quantity").val();
      var product3quantity = $("input#product3quantity").val();
      var product4quantity = $("input#product4quantity").val();
      var product5quantity = $("input#product5quantity").val();
  
      var dataString = 'product1name='+ product1name + 'product2name=' + product2name + 'product3name=' + product3name + 'product4name=' + product4name + 'product5name=' + product5name + 'product1quantity='+ product1quantity + 'product2quantity='+ product2quantity + 'product3quantity='+ product3quantity + 'product4quantity='+ product4quantity + 'product5quantity='+ product5quantity + 'salesid='+ salesid + 'email='+ email + 'wpuseremail='+ wpuseremail;
  
      $.ajax({  
        type: "POST",
        url: "process.php",
        data: dataString,
        success: function(json) {  
          $('#contact_form').html("&lt;div id='message'&gt;&lt;/div&gt;");
          $('#message').html(json.type)
          .append(json.message)
          .hide()
          .fadeIn(1500, function() {
            $('#message').append("&lt;img id='checkmark' src='images/check.png' /&gt;");
          });
        }
      });
      return false;
  
  });
  </code></pre>
  
  <p>Here is my php:</p>
  
  <pre><code>&lt;?php
  $product1quantity = $_POST["product1quantity"];
  $product2quantity = $_POST["product2quantity"];
  $product3quantity = $_POST["product3quantity"];
  $product4quantity = $_POST["product4quantity"];
  $product5quantity = $_POST["product5quantity"];
  
  $username = "user";
  $password = "pass";
  $hostname = "host"; 
  
  $dbhandle = mysql_connect($hostname, $username, $password)
   or die("Unable to connect to MySQL");
  
  $selected = mysql_select_db("dbname",$dbhandle)
    or die("Could not select dbname");
  
  $result = "INSERT INTO dbname.tablename (product1name, product2name, product3name, product4name, product5name, product1quantity, product2quantity, product3quantity, product4quantity, product5quantity, id) VALUES ('', '', '', '', '', product1quantity, product2quantity, product3quantity, product4quantity, product5quantity, NULL)";
  mysql_query($result);
  
  mysql_close($dbhandle);
  
  $response = array('type'=&gt;'', 'message'=&gt;'');
  $response['type'] = 'success';
  $response['message'] = 'Thank-You for submitting the form!';
  print json_encode("success");
  ?&gt;
  </code></pre>
  
  <p>I've confirmed that it works when i do NOT use variables in the INSERT statement, but rather hardcoded values. Something seems wrong with my variables.</p>