I have a dynamic rows coming from the database. each row has an order field. I want to make the user able to change the order by entering the order in text boxes show's next to each row, and when the user click save each row will be updated with the new order.
My problem is when I wrote this code:
<table>
<?
foreach($results as $p)
{
echo '
<tr>
<td>'.$p['page_title'].'</td>
<td><input type="text" size="2" id="'.$p['page_id'].'" name="s[]" value="'.$p['menu_order'].'"></td>
</tr>';
}
?>
<tr><td colspan="2"><input type="submit" value="Save Order"></td></tr>
</table>
as you can see that every dynamic text box would give the the new order after posting the form, but the Question is how I can know this order to which row ?
the image would explain more. After I clicked Save the s
array would be like this:
Array ( [0] => 2 1 => 3 [2] => 1 )
However, I cannot know the page that I want to update !!