title: no results in inserting values to MySQL with AJAX
body: <p>on my research site, I have a few radio buttons and I want to send their values to MySQL table using jquery and AJAX. All buttons and jquery code are put in <strong>single-project.php</strong> (I modified WordPress theme) and the bits of code that should handle interaction with the MySQL are put in the <strong>db.php</strong> in the same folder.</p>
  
  <p>However, something is not in order, because values do not appear on the database table. Could someone help?</p>
  
  <p><strong>jquery:</strong></p>
  
  <pre><code>      //the last button
          $('#submit_last_button').click(function(){
          SomeVariable = $('input:radio[name=lastRadio]:checked').val();
               if (!$("input:radio[name=lastRadio]").is(":checked")) {
                $("label#lastRadio_error").show();
                $("input#lastRadio").focus();
                return false;
              } else {
              if ('input:radio[name=lastRadio]:checked')
              $('#PreviousButtonDiv').hide();
              $('#NextDiv').show();
              $.post('db.php',{action: "submit_last_button", previous_variable:SomePreviousVariable, last_variable:SomeVariable},function(res){
              $('#result').html(res);
              });
              }
            });
          });   
  </code></pre>
  
  <p><strong>db.php:</strong></p>
  
  <pre><code>&lt;?php
  $con = mysql_connect('localhost','user', 'password');
  $db     = mysql_select_db('my_database');
  
  if($_POST['action'] == 'submit_last_button'){
  
      $previous_variable  = mysql_real_escape_string($_POST['previous_variable']);
      $last_variable = mysql_real_escape_string($_POST['last_variable']);
  
  
  
  
      $sql   = "insert into MyTable (id, variable1, variable2) values ( NULL, '$previous_variable', '$last_variable')";
      $query = mysql_query($sql);
      if($query){
          echo "Record Inserted.";
      }else {
          echo "Something Wrong!";
      }
  }
  ?&gt;
  </code></pre>