title: get data from dynamically created html table for certain columns
body: <p>my current problem is : 
  I have a HTML table created "dynamically" according to how many rows brings back a mysql_query. The first column gets tha data from the query and the second column have a text field (see below):</p>
  
  <pre><code>&lt;?php 
      $selApart = "SELECT idAPARTMENT FROM BUILDING, APARTMENT WHERE APARTMENT.BUILDING_ID = BUILDING.idBUILDING AND idBUILDING = '$building'";
      $res = mysql_query($selApart) or die("Could not execute query.");
  
  ?&gt;
    &lt;table width="244" border="0" cellspacing="0" id="hours_table"&gt;
      &lt;tr&gt;
        &lt;td width="121"&gt;APARTMENT&lt;/td&gt;
        &lt;td width="119"&gt;HOURS&lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php 
      $rcnt = 0;
      while($r = mysql_fetch_array($res)){
          $a = $r['idAPARTMENT'];
          $rcnt++;
          $rid = 'row'.$rcnt;
      ?&gt;
      &lt;tr&gt;
        &lt;td&gt;'&lt;?php echo $a?&gt;'&lt;/td&gt;
        &lt;td id='&lt;?php echo $rid?&gt;'&gt;&lt;input type="text" name="hours" id="hours" value="0"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php } ?&gt;
  &lt;input type="submit" name="complete" id="complete" align="middle" value="INSERT"/&gt;
  </code></pre>
  
  <p>After my table is "ready", I want to fill in my text fields and insert these values in an sql table. What I don't know is how I can get the value of each column through the id I set, sth like </p>
  
  <pre><code>if(isset($_POST['complete'])){
      for($i=0; $i&lt;$rcnt; $i++){
         //INSERT INTO APARTMENT (idAPARTMENT, HOURS) VALUES ($a, **table.row.id**)
      }
  }
  </code></pre>
  
  <p>Can someone help? Is this possible to be done?
  Thanks in advance!</p>