the below code shows a table with users to be accepted or declined. the code as it is has a dropdown on the end allowing to either accept it, deny it or leave as is. there is a button on the bottom to submit the form and after that there should be a php script that decides which user is accepted, denied or still pending.
what would be the best approach to make this work since i find it hard to link the dropdown box and the id.
<table align='center' width='90%'>
<tr>
<center><td><strong>ID:</strong></td></center>
<center><td><strong>Name:</strong></td></center>
<center><td><strong>Level:</strong></td></center>
<center><td><strong>Job:</strong></td></center>
<center><td><strong>Guild:</strong></td></center>
<center><td><strong>Date:</strong></td></center>
<center><td><strong>Action:</strong></td></center>
</tr>
<?php
$id = 0;
$result=mysql_query("SELECT * FROM accounts WHERE active ='0' ORDER BY date LIMIT 10") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$id = $id + 1;
?>
<form method='POST' action=''>
<tr>
<center><td><?php echo $row['id']; ?></td></center>
<center><td><?php echo $row['user']; ?></td></center>
<center><td><?php echo $row['level']; ?></td></center>
<center><td><?php echo $row['job']; ?></td></center>
<center><td><?php echo $row['guild']; ?></td></center>
<center><td><?php echo $row['date']; ?></td></center>
<td>
<select name='action_<?php echo $row['id']; ?>'>
<option value='none'>None</option>
<option value='accept'>Accept</option>
<option value='decline'>Decline</option>
</select>
</td>
</tr>
<?php } ?>
<tr>
<br /><td align='right'><input type='submit' value='Submit' name='submit' /></td>
</tr>
</form>
</table>
<?php
if(isset($_POST['submit'])) {
if(isset($_POST['action_'.$row['id'].'']) && $_POST['action_'.$row['id'].''] == "accept" ) {
$acc = mysql_query("UPDATE `accounts` SET `active`='1' WHERE `id` = '".$row['id']."'");
echo "<meta http-equiv=refresh content=\"5; url=?wesofly=main&page=recruitment\">";
}elseif(isset($_POST['action_'.$row['id'].'']) && $_POST['action_'.$row['id'].''] == "decline" ) {
$dec = mysql_query("DELETE * from `accounts` WHERE '".$row['id']."'");
echo "<meta http-equiv=refresh content=\"0; url=?wesofly=main&page=recruitment\">";
}
}
?>