title: PHP Not Receiving AJAX Post Data, When AJAX is sending correctly
body: <p>I am using the following AJAX to make a call to a PHP function:</p>
  
  <pre><code> $.ajax({
      url : 'php/jstranslator.php',
      type : 'post',
      data : {'action' : 'campaignnamecheck',
             'newcampaignname' : campaignname,
             'oldcampaignname' : oldcampaignname },
      success : function(result) {
          check = result;
          console.log("campaignnamecheck: " + check);
      },
      error : function(xhr, desc, err) {
          console.log(xhr);
          console.log("Details: " + desc + "\nError:" + err);
      }
  });
  </code></pre>
  
  <p>The php receiving this call looks like this:</p>
  
  <pre><code>if ($_POST['action'] == "campaignnamecheck") {
      $newcampaignname = $_POST['newcampaignname'];
      $oldcampaignname = $_POST['oldcampaignname'];
  
      campaignnamecheck($newcampaignname, 
                        $oldcampaignname);
  
  }
  </code></pre>
  
  <p>And the campaignnamecheck function looks like this:</p>
  
  <pre><code>function campaignnamecheck($newcampaignname, $oldcampaignname) {
      $conn = conn();
      echo "php oldcampaignname: " . $oldcampaignname;
      // Select any campaigns 
      $campaignsql = "SELECT CampaignName " .
          "FROM campaignstest " .
          "WHERE CampaignName = '" . $newcampaignname . "' ";
      if(!$campaignresult = $conn-&gt;query($campaignsql)){
          die('There was an error running the query "' . $campaignsql . '" [' . $conn-&gt;error . ']');
      }
  
      // If the campaign name remained the same as before it is a safe campaign name
      if ($newcampaignname == $oldcampaignname) {
      } else {
          // If the campaign name changed, or if it's a new campaign, then check to see if the name already exists in the database
          if ($campaignresult-&gt;num_rows == 0) {
              echo "true";
          } else {
              echo "false";
          }
      }
  }
  </code></pre>
  
  <p>The error I am receiving in my apache error log is as follows:</p>
  
  <pre><code>[Wed Mar 07 16:30:00.330318 2018] [:error] PHP Warning:  Missing argument 2 for campaignnamecheck(), called in /var/www/html/test/php/jstranslator.php on line 110 and defined in /var/www/html/test/php/campaignsfuncs.php on line 747
  [Wed Mar 07 16:30:00.330779 2018] [:error] PHP Notice:  Undefined variable: oldcampaignname in /var/www/html/test/php/campaignsfuncs.php on line 749
  </code></pre>
  
  <p>When I look in the network tab of the console on chrome I can see that the values you have been set:</p>
  
  <pre><code>action:campaignnamecheck
  newcampaignname:test
  oldcampaignname:none
  </code></pre>
  
  <p>What on earth am I missing?</p>