title: Create multiple forms in a html table
body: <p>I've got a MySQL database and a table called courses.  I would like to show the records of this table within an html table, but I would also like to edit them with a submit button at the end.</p>
  
  <p>I know this has been asked before, but I'm still struggling with how I should properly proceed.</p>
  
  <p>I currently have:</p>
  
  <pre><code>&lt;tbody&gt;
      &lt;?php
          foreach ($db-&gt;getResultSet() as $row) {
              extract($row);
              ?&gt;
              &lt;tr&gt;
                  &lt;form id="myTable" name="editrecord" action="course.php" method="post"&gt;
                      &lt;input type="hidden" name="code" value="&lt;?php echo $code; ?&gt;" /&gt;&lt;!--PrimaryKey--&gt;
                      &lt;td&gt;&lt;?php echo $code; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="name" value="&lt;?php echo $name; ?&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="desc" value="&lt;?php echo $desc; ?&gt;" /&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="submit" name="Edit" value="Edit!" /&gt;&lt;/td&gt;
                  &lt;/form&gt;
              &lt;/tr&gt;
              &lt;?php
          }
      ?&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>Now this seems to work fine.  However I'm aware that <code>&lt;form&gt;</code> should not be inside <code>&lt;tr&gt;</code> or anywhere else other that <code>&lt;td&gt;</code></p>
  
  <p>I'm aware I could use various divs and set display properties to table layout etc. however I'd like to avoid this as I am using pre-made javascript that can sort and filter data which requires me to use <code>&lt;table&gt;</code></p>
  
  <p>I also tried a for loop outside the table to create 1 form per record and use the primary key as the form's id.  Then proceed with <code>echo "&lt;td&gt;&lt;input form='$code' ...</code>.  But this doesn't work in Explorer</p>
  
  <p>What is the correct way to implement something like this?</p>