1) Don't use short tags. This:
Code:
<input name="username[]" value="<?=$r['user_name'] ?>" />
ought be:
Code:
<input name="username[]" value="<?php echo $r['user_name'] ?>" />
You'd be better off setting each name with the userid or username as the key, i.e:
Code:
<input name="username[<?php echo $r['userid'].']" value="'.$r['user_name'] ?>" />
And then you can loop through, using a foreach and assign correctly. If you use [], each key will just be an incremented number. Using the above, for example, you would use:
Code:
foreach ($_POST['username'] as $key => $val)
{
[$key is your userid and $val is the value]
}