title: Multiple forms with AJAX on one page
body: <p>I am developing a list of submissions in the admin area of my website, which I can approve/disprove with a form, with an ID of the submission in a hidden input, and the select box with Approve/Reject in. When the select box is changed, the ajax submits the form, along with the hidden ID input, then the PHP script edits the submission in the database.</p>
  
  <p>It was all working fine with one submission (1 form) on the page, but now there is more than one form, it is POSTing the wrong values to the PHP script.</p>
  
  <pre><code>&lt;tbody&gt;
          &lt;?php
              // connect to mysql
              mysql_connect('#######', '#######', '#######');
              mysql_select_db('jcvideos');
  
              // query
              $query = mysql_query("SELECT * FROM videos");
  
              // loop thru
              while($row = mysql_fetch_assoc($query)) {
          ?&gt;
          &lt;tr&lt;?php if($row['accepted']==0) {echo " class='warning'";}?&gt;&gt;
              &lt;td&gt;&lt;?php echo $row['id'];?&gt;&lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="//youtu.be/&lt;?php echo $row['ytid'];?&gt;" target="_blank"&gt;
                      &lt;?php
                          $url = "http://gdata.youtube.com/feeds/api/videos/". $row['ytid'];
                          $doc = new DOMDocument;
                          $doc-&gt;load($url);
                          echo $doc-&gt;getElementsByTagName("title")-&gt;item(0)-&gt;nodeValue;
                      ?&gt;
                  &lt;/a&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row['date'];?&gt;&lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="mailto:&lt;?php echo $row['submitter'];?&gt;"&gt;
                      &lt;?php echo $row['submitter'];?&gt;
                  &lt;/a&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;form id="form&lt;?php echo $row['id'];?&gt;" class="reviewform" method="post" action="review.php"&gt;
                      &lt;input type="hidden" value="&lt;?php echo $row['id'];?&gt;" name="vidid"&gt;
                      &lt;select name="status"&gt;
                          &lt;option value="0"&lt;?php if($row['accepted']==0) {echo ' selected';}?&gt;&gt;Pending review&lt;/option&gt;
                          &lt;option value="1"&lt;?php if($row['accepted']==1) {echo ' selected';}?&gt;&gt;Rejected&lt;/option&gt;
                          &lt;option value="2"&lt;?php if($row['accepted']==2) {echo ' selected';}?&gt;&gt;Accepted&lt;/option&gt;
                      &lt;/select&gt;
                  &lt;/form&gt;
              &lt;/td&gt;
              &lt;td&gt;&lt;?php echo $row['showdate'];?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php
              } // end of loop
          ?&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;?php include('../includes/footer.php');?&gt;
  &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://malsup.github.com/jquery.form.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      $("select").change(function(){
          $('.reviewform').ajaxSubmit();
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried using IDs, then it didn't POST at all. What am I missing here?</p>