title: Using dynamically created array of textboxes in php
body: <p>I have an array of textboxes which are dynamically created in PHP. I have 100 textboxes for CustomerIDs and 100 textboxes for CustomerEmails and besides that i have 100 update buttons.</p>
  
  <p>Whenever i press the update button, it should update only that record of particular index.</p>
  
  <p>The initial values of textboxes are coming from database.</p>
  
  <p>The problem is that i don't know how to get the index of particular texbox. </p>
  
  <pre><code>while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
  {
  $rowCounter = $rowCounter + 1;
  echo '&lt;tr&gt;';
  echo '&lt;td&gt;&lt;input name="txtRowCounter" id="txtRowCounter" type="text" value ="' . $rowCounter .'" /&gt; &lt;/td&gt;';  
  echo '&lt;td&gt;' . $row['CustomerID'] . '&lt;/td&gt;';
  echo '&lt;td&gt;&lt;input name="txtEmail" id="txtEmail" type="text" value ="' . $row['CustomerEmail1'] .'" /&gt; &lt;/td&gt;';    
  
  echo '&lt;td&gt;&lt;input id="btnUpdate" type="submit" name="btnUpdate" value = "Update" onclick="updateButton( document.getElementsByName(\'txtEmail\')[' . $rowCounter . '].value)" /&gt; &lt;/td&gt;';
  echo '&lt;/tr&gt;';
  } 
  </code></pre>