Updating multiple MYSQL rows with one submit button : <p>i was trying to updating multiple MYSQL rows with one submit button,</p>

<p>before i used to create submit for each row, but since i have a lot of rows now i need to update them all together</p>

<p>index.php</p>

<pre><code>&lt;?php
if (mysqli_num_rows($row){
while($row1= mysqli_fetch_assoc($row){


id&lt;input  type="text" value="&lt;?php echo $row["id"];?&gt;"  name='id' id="id"  &gt;
id&lt;input  type="text" value="&lt;?php echo $row["name"];?&gt;"  name='name' id="name"  &gt;
}
&lt;button type="submit" formaction="update.php"&gt;
         submit
      &lt;/button&gt;

}
</code></pre>

<p>update.php</p>

<pre><code>
$id= $_POST['id'];
$name= $_POST['name'];

$sql = "UPDATE `$tabelname` SET  
name='$name' 
WHERE id='$id'";

</code></pre>

<p>its updating the first row only</p>
