title: Checkbox onChange submit form
body: <p>What i have is a array of items from my mySQL database and each item has a checkbox. i am trying to make it so when you click on the checkbox it will submit the information to the database for the item that got checked or unchecked. have i have it is unchecked = 1 and checked = 0. this is for where i want to display the item.</p>
  
  <p>Now my issue is I can't seem to get anything to submit into my database, I don't understand jQuery enough to be able to write a function for it, so i need some help. here is what i got for my code.</p>
  
  <pre><code>if(isset($_POST['submit'])){
          foreach($_POST['id'] as $id){
              $value = (isset($_POST['location'][$id]) &amp;&amp; $_POST['location'][$id]=="0" ? '0' : '1');
              $insert = mysql_query("UPDATE items SET location='$value' WHERE id='$id'") or die('Insert Error: '.mysql_error());
          }
      }
  echo '&lt;form id="form1" method="post"&gt;&lt;input type="submit" name="submit" value="Submit"&gt;';
  $result = mysql_query("SELECT * FROM items")
      or die("Query Failed: ".mysql_error());
      $counter = 0;
      echo '&lt;div class="specialcontainer"&gt;';
  while($row = mysql_fetch_array($result)){
      list($id, $item_info, $item_img, $price, $sale, $location) = $row;
      if($location == '0'){
          $set_checked = ' checked="checked" ';
      }else{
          $set_checked = '';
      }
      if($counter % 5==0) {
          echo '&lt;/div&gt;';
          echo '&lt;div class="specialcontainer"&gt;';
      }
      echo '&lt;div class="special"&gt;&lt;img src="../images/items/'.$item_img.'" width="130" /&gt;&lt;br /&gt;';
      echo $item_info.'&lt;br /&gt;';
      echo 'Reg. $'.$price.'&lt;br /&gt;';
      echo 'Sale $'.$sale.'&lt;br /&gt;';
      echo 'Slide Show: &lt;input type="checkbox" id="ch" value="0" name="location['.$id.']"'.$set_checked.' /&gt;&lt;br /&gt;';
      echo '&lt;input type="button" value="Edit" name="edit" onclick="window.location.href=\'specials.php?action=edit&amp;id='.$id.'\'"&gt;';
      echo '&lt;input type="button" value="Delete" name="Delete" onclick="window.location.href=\'specials.php?action=delete&amp;id='.$id.'\'"&gt;';
      echo '&lt;input type="hidden" name="id[]" value='.$id.' /&gt;';
      echo '&lt;/div&gt;';
      $counter++;
  }
  echo '&lt;/div&gt;';
  echo '&lt;input type="submit" name="submit" value="Submit"&gt;&lt;/form&gt;';
  </code></pre>
  
  <p>so as you can see, i do have the submit button there, but my plan is to remove it for the onChange submit. I've tried the onchange="this.form.submit();" in the checkbox parameter but it don't work properly. so i just want it to submit anytime a checkbox gets clicked on kinda thing.</p>