0

I want to create simple form to validate each row of mysql_fetch_array if it's a 'good' or 'bad' row below :

<form action="activated.php" method="post">
<tbody>                                      
<?php
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['AccountName'] . "</td>";
echo "<td>" . $row['Amount'] . "</td>";
echo "<td>" . $row['TransferTo'] . "</td>";
echo "<td>" . $row['DateTransfer'] . "</td>";
echo "<td><input name=\"".$row['ID']."\" type=\"radio\" value=\"OK-".$row['ID']."\" /></td>";
echo "<td><input name=\"".$row['ID']."\" type=\"radio\" value=\"BAD-".$row['ID']."\" /></td>";
echo "</tr>"; 
}
?>
</tbody> 
</table>
<input type="submit" value="Submit" class="submit" />
</form>

my question is how to manage this dynamic value of radio button's name and value on activated.php? I mean, how to get each value of radio button so I can process it. I have no problem if the name of radio button is static. but in this case it's dynamic.

4

1 回答 1

0

cycle through the $_POST arguments. You might want to preface the radio names with something you can specifically search for the help you, like echo '<input type="radio" name="radio-'.$row['ID'].'"...

You can search each key returned in $_POST to see which ones begin with radio-

于 2012-06-09T19:57:50.837 回答