Update multiple records

hi,
I have multiple input text boxes to update with one form as you can imagine from my title. Now I iterate records trough array


foreach ($checked as $id){
   $row = Category::find_by_id($id);
   $id = $row->id;
   $name = $row->name;

and form input like this


 <label>Category
         <span class="small"> id <?php echo $id ?></span>
    </label>
    <input type="text" name="<?php $name ?>" id="<?php $name ?>" value="<?php echo $name ?>" />
}

Now I need to handle multple input values and update each.


if((isset($_POST['submit']))) {
........ 

}

found another solution. Inline edit with ajax.

or you can add hidden pk field value and loop as:
just a dummy code:

keep hidden fields as an array
<input type=“hidden” name=“id” value=“{value from loop}” />


//post operation
if(!empty($_POST['id'])){
	foreach($_POST['id'] as $key =&gt; $value){
		echo "UPDATE table SET `name` = '".mysql_real_escape_string($_POST['name'][$key])."' WHERE id = '".mysql_real_escape_string($_POST['id'][$key]).""';";
	}
}