title: PHP Post after Ajax returns values
body: <p>For some reason a <code>POST</code> variable from my <code>form</code> is always empty. Here's my code...
  I have a bootstrap select which returns information which I display upon selecting a new item from the dropdown (select).</p>
  
  <p>Code:</p>
  
  <pre><code>$(function() {
  
  
      $("#shiftsDD").change(function(){
          var selectedItemId = $('#shiftsDD option:selected').val();  
  
          $.post('/step/services/shiftInfo.php', { shiftID : selectedItemId }, function(res){
            $("#shiftCard").show();
            var jsonRes = $.parseJSON(res);
             $("#address").html(jsonRes[0]);
             $("#duties").html(jsonRes[1]);
             $("#employer").html(jsonRes[4]);
             $("#payRate").html(jsonRes[5]);
             $("#theShiftID").html(jsonRes[6]);
             console.log(res);
  
          });
      });
  
  });
  </code></pre>
  
  <p>All of those values from the jsonRes array are assigned in here:</p>
  
  <pre><code>&lt;form role="form" name="cardForm" method="POST"&gt;
  &lt;div class="card" id="shiftCard"&gt;
  Employer:
  &lt;h3 id="employer"&gt;Test Employer&lt;/h3&gt;&lt;br&gt;
  Address:
  &lt;h3 id="address"&gt;Test Address&lt;/h3&gt;&lt;br&gt;
  Duties include:
  &lt;h3 id="duties"&gt;Test duties&lt;/h3&gt;&lt;br&gt;
   Pay rate:
  &lt;h3 id="payRate"&gt;Test PayRate&lt;/h3&gt;&lt;br&gt;
  &lt;h5 id="theShiftID" name="myShiftID"&gt;&lt;/h5&gt;
  &lt;br&gt;
  &lt;button type="submit" class="btn btn-lg btn-green-solid" name="shiftsBtn"&gt;Accept work&lt;/button&gt;
  &lt;/div&gt;
  &lt;/form&gt;  
  </code></pre>
  
  <p>I've tried lots of things but I am new to ajax and not a pro in PHP so I don't know why:</p>
  
  <pre><code> if (isset($_POST['shiftsBtn'])) {
  
  $theId = $_POST['myShiftID'];
  ...
  </code></pre>
  
  <p><code>myShiftID</code> is always empty</p>
  
  <p>ShiftsDD select code:</p>
  
  <pre><code>&lt;select name="shiftsDD" id="shiftsDD" class="form-control form-control-45"&gt;
  &lt;option value="0"&gt;Select a shift&lt;/option&gt;
  &lt;?php
     $theQuery = "
     SELECT DATE_FORMAT(StartTime,  '%d/%b/%Y' ) AS ShiftDate, ShiftID,ShiftTitle,TIMESTAMPDIFF(MINUTE, StartTime, EndTime) AS ShiftDuration, ROUND(PayRate,2) as PayRate FROM Shifts;
     ";
   $result = $DBH-&gt;query($theQuery);
   $result-&gt;execute();
  
     while($r = $result-&gt;fetch()) {
   $theDuration = $r['ShiftDuration'] / 60;
  
   echo "&lt;option value='" . $r['ShiftID'] ."'&gt;[". $r['ShiftDate'] . "] " . $r['ShiftTitle'] . " (Hours: " . $theDuration . ")&lt;/option&gt;"; 
  }
  
  ?&gt;
  &lt;/select&gt;
  </code></pre>