I have a form containing 36 radio button selection sections. These are being generated from an SQL query:
//sql query
<form method="post" action="next.php">
<table border=1><tr><td>ID</td>selection</td></tr>
<?php
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["ID"]. "</td><td><input type=\"radio\" name=\"".$row["ID"]."\" value=\"1\">1<input type=\"radio\" name=\"".$row["ID"]."\" value=\"X\">X<input type=\"radio\" name=\"".$row["ID"]."\" value=\"2\">2</td></tr>";
}
?>
<input type="submit" name="submit" value="Submit"></table></form>
So, the name of each radio section is the ID
from the query. When the user clicks on the Submit
button I need all the radios are set (loop through them). If not, then I want to show an error but keeping the user on the same page without loosing all the selections he made already. If all radios are set, then go to next.php
where I will process the stuff from $_POST
.