I am developing a website wherein users are able to add friends. Here, I’m using a simple SELECT statement to show which users are currently pending to be a friend. Here’s what I have so far:
while ($row = mysql_fetch_array($result))
{
<tr>
<td><img src="<?=$photo;?>" /></td>
<td><?=$realname;?></td>
<td><?=$userid;?></td>
<td><?=$username;?></td>
<td>
<select name="action">
<option value="skip">Skip (no action)</option>
<option value="accept">Accept</option>
<option value="deny">Deny</option>
</select>
<input type="hidden" name="uid" value="<?=$userid;?>" />
</td>
</tr>
}
Now, I’m not so sure about the select part. It’s easy to process if I will only select options for one user but how should I go about it so that when I select different options for two different users, I’d still be able to separate the results? Because right now, what it’s giving me is uid=1&action=accept&uid=2&action=deny. I’m thinking of changing the select name from action to action[] but I may be wrong. Any help would be greatly appreciated.
You can use the uid as the key for your action. For example: