title: UPDATE database after select option change
body: <p><img src="https://i515.photobucket.com/albums/t355/Infinity_Thunder/2_zpsdce2693b.png" alt="Database"></p>
  
  <p><img src="https://i515.photobucket.com/albums/t355/Infinity_Thunder/1_zps34036dcf.png" alt="Result"></p>
  
  <p>The "Reference No , Status" both are from Database. The below codes displayed the result in top link. <strong>Here's my question:</strong> How do I update my Database from "pending" to "deliver" straight away after I change the select Option from "Pending" to "Delivered"? </p>
  
  <pre><code>&lt;?php
  echo '&lt;tr&gt;
      &lt;td&gt;Reference No&lt;/td&gt;
      &lt;td&gt;Status&lt;/td&gt;
  &lt;/tr&gt;';
  $result = mysql_query("select * FROM orderhistory"); 
  while($row=mysql_fetch_array($result)){
      $shopReference = $row['reference'];
      $status = $row['status'];
      if($status == 'pending')
      {$status = 'Pending';}
      elseif($status == 'delivered')
      {$status = 'Delivered';}
      if($q==0) continue;
  ?&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;?php echo $shopReference?&gt;&lt;/td&gt;
      &lt;td&gt;
          &lt;select id="status" name="status" size="1" required&gt;
              &lt;option value="" style="display:none"&gt;Status&lt;/option&gt;
                  &lt;option value="pending" &lt;?php if($status == 'Pending') echo "selected"; ?&gt;&gt;Pending&lt;/option&gt;
                  &lt;option value="delivered" &lt;?php if($status == 'Delivered') echo "selected"; ?&gt;&gt;Delivered&lt;/option&gt;
              &lt;/optgroup&gt;
          &lt;/select&gt;
      &lt;/td&gt;
  
  &lt;?php                   
  }
  ?&gt;
  </code></pre>
  
  <p>The SQL to update the database most probably will be this </p>
  
  <pre><code>$sql = "UPDATE orderhistory SET status= '$status' WHERE reference = '$reference'";
  </code></pre>
  
  <p>But what jQuery or any other thing should I use? </p>
  
  <p>I guess should be some function on <code>onChange</code>? I'm not very sure how to use it. I tried to search online, but can't get any idea about it... Sorry, I am new...</p>