This foreach generates a list of choices. When selecting any choice from the list it only passes the data from the last available choice, not the one the user selects. I know it isn't clean or secure so no worries there. . .(one step at a time. . .) I just need it to pass the data for the item selected instead of always the last one in the list of choices.
<?php foreach ($result as $row) : ?>
<form action="selected-results.php" type="get">
<tr>
<td><input type="text" name="offnum" value="<?php echo escape($row["offnum"]); ?>" size="11" readonly></td>
<td><input type="text" name="offdesc" value="<?php echo escape($row["offdesc"]); ?>" size="20" readonly></td>
<td><input type="text" name="stafn" value="<?php echo escape($row["stafn"]); ?>" size="10" readonly></td>
<td><input type="text" name="staln" value="<?php echo escape($row["staln"]); ?>" size="10" readonly></td>
<td><input type="text" name="slots" value="<?php echo escape($row["slots"]); ?>" size="3" readonly></td>
<td><input type="text" name="olitaclvl" value="<?php echo escape($row["olitaclvl"]); ?>" size="1" readonly></td>
<td><input type="text" name="omathaclvl" value="<?php echo escape($row["omathaclvl"]); ?>" size="1" readonly></td>
<td><input type="text" name="stuid" value="<?php echo "$stuid"; ?>" size="5" readonly></td>
<td><input type="text" name="stufn" value="<?php echo "$stufn"; ?>" size="10" readonly></td>
<td><input type="text" name="stuln" value="<?php echo "$stuln"; ?>" size="10" readonly></td>
<td><input type="submit" value="Select"></td>
</tr>
<?php endforeach; ?>
I thought by putting each choice in a form by itself would make it pass the data from that specific form (choice) but it doesn't. It always passes the last choice in the list no matter which the user selects. The data in the choices is read from a database and displayed in the choices list. The user clicks their selection using the "Select" button at the end of each choice.
Thank you for any insights.
I have tried <form action="selected-results.php" type="post">
but that didn't work either.