The undernoted form gives a series of options to choose using a select form. When the values are retrieved from the $_POST array although the correct id is being passed the value for season simply seems to be the last value in the form.
I have checked my code and league is not being updated anywhere else as far as I can see.
I'm sure I'm missing something obvious but can't figure it out!
<form method = 'post' action = 'index.php?choice=matcht&stage=1'><table width = '50%' border = '1'><thead><tr>
<th>Select</th>
<th>League</th>
<th>Season</th>
</tr></thead>
<tr><td><input type = 'radio' name = 'id' value = '1' ></td>
<td><input type = 'text' name = 'league' value = 'MLB21' readonly></td>
<td><input type = 'text' name = 'season' value = '12' readonly></td>
</tr>
<tr><td><input type = 'radio' name = 'id' value = '25' ></td>
<td><input type = 'text' name = 'league' value = 'MLB21' readonly></td>
<td><input type = 'text' name = 'season' value = '13' readonly></td>
</tr>
<tr><td><input type = 'radio' name = 'id' value = '49' ></td>
<td><input type = 'text' name = 'league' value = 'MLB21' readonly></td>
<td><input type = 'text' name = 'season' value = '14' readonly></td>
</tr>
<tr><td><input type = 'radio' name = 'id' value = '73' ></td>
<td><input type = 'text' name = 'league' value = 'MLB21' readonly></td>
<td><input type = 'text' name = 'season' value = '15' readonly></td>
</tr>
<tr><td><input type = 'radio' name = 'id' value = '97' ></td>
<td><input type = 'text' name = 'league' value = 'MLB21' readonly></td>
<td><input type = 'text' name = 'season' value = '16' readonly></td>
</tr>
<tr><td colspan = '3' align = 'center'><input type = 'submit' name = 'go' value = 'GO'></td></tr>
</table>
</form>
Here is the PHP generating the HTML:
$sql='SELECT `TeamID`, `League`,`Season` FROM teams WHERE `FranchiseID` = 0 GROUP BY `League`,`Season` ORDER BY `League` ASC ,`Season` ASC ';
$unmatched = $db2->get_results($sql);
if ($db2->num_rows>0) {
echo "<form method = 'post' action = 'index.php?choice=matcht&stage=1'>";
echo "<table width = '50%' border = '1'>";
echo "<thead><tr>
";
echo "<th>Select</th>
";
echo "<th>League</th>
";
echo "<th>Season</th>
";
echo "</tr></thead>
";
foreach ( $unmatched as $unmatch )
{
// Access data using object syntax
echo "<tr>";
echo "<td><input type = 'radio' name = 'id' value = '$unmatch->TeamID' ></td>
";
echo "<td><input type = 'text' name = 'league' value = '".$unmatch->League."' readonly></td>
";
echo "<td><input type = 'text' name = 'season' value = '".$unmatch->Season."' ></td>
";
echo "</tr>
";
}
echo "<tr><td colspan = '3' align = 'center'><input type = 'submit' name = 'go' value = 'GO'></td></tr>
";
echo "</table>
";
echo "</form>
";