title: Update echoed data using WHILE loop. Only updates one record
body: <p>I can't seem to be able to update any records except the first one.
  I am not sure how to modify any of the displayed records.</p>
  
  <pre><code>&lt;?php
  
      if(isset($_POST["action"]) == "update")
      {
          $id = $_POST['m_id'][0];
          $type = $_POST['type'][0];
          // if I echo $id &amp; $type, it only gives me the first record.**
          mysql_query("
            UPDATE membership_type
            SET mt_type ='$type'
            WHERE mt_id = '$id'"
          );
      } 
  
      ?&gt;
  </code></pre>
  
  <p>ALl of this is within the same php page.</p>
  
  <pre><code>&lt;form name=form action='' method='post'&gt;
  
    &lt;?php 
    $result=mysql_query("SELECT * FROM membership_type;");
    while($rows=mysql_fetch_array($result))
    {  ?&gt;
      &lt;input size=35 class=textField type=text name='type[]' value='&lt;?php echo  $rows['mt_type']; ?&gt;'&gt;
      &lt;input type=hidden name='m_id[]' value="&lt;?php echo $rows['mt_id']; ?&gt;"&gt;
      &lt;input type=submit value="Update"&gt;
    &lt;?php 
    } 
    ?&gt;
  </code></pre>
  
  <p>How do I edit any of the displayed records by simply clicking Update button???</p>