title: Javascript/AJAX, PHP, and MySQL checkout
body: <p>brand new to AJAX so I'm having a tough time finding a resource for my specific situation.</p>
  
  <p>I am attempting a simple checkout system utilizing a MYSQL database with a table layout like so:</p>
  
  <p><img src="https://i.stack.imgur.com/NepME.png" alt="mysql table layout"></p>
  
  <p>Right now my site layout looks like:</p>
  
  <ol>
  <li><p>Dropdown menu with "Check In" or "Check Out" options</p></li>
  <li><p>Dropdown menu with each item name in the table (using PHP to access)</p></li>
  <li><p>Submit button</p></li>
  </ol>
  
  <p>The next thing to do is create a function for the submit button that increments or decrements the "Available" column for the item selected. I understand that this is where ajax comes in since I need to send the selected ID for PHP to use. </p>
  
  <p>My only experience with ajax is <a href="http://www.w3schools.com/php/php_ajax_database.asp" rel="nofollow noreferrer">this link</a> which is similar to what I want to do, but not quite the same. I know the function I want to use will look something like this:</p>
  
  <pre><code>function updateStuff() {
      if (window.XMLHttpRequest) {
         // code for IE7+, Firefox, Chrome, Opera, Safari
         xmlhttp = new XMLHttpRequest();
      } 
      else {
         // code for IE6, IE5
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.open("GET","update.php?q="+str,true);
      xmlhttp.send();
  }
  </code></pre>
  
  <p>But it's not the same, because I need to use the id's of the currently selected option in each of the two dropdowns to determine what happens with the table. </p>
  
  <p>So do I need to back up and get some understanding of AJAX? Or is there a simple enough way to edit this for my purposes where I don't need to have a complete understanding to make this work. </p>