I'm having a problem with an undefined index error message in PHP. I have a form with several <select>
inputs, and all of them work except for one. On one I get the undefined index error message. I don't understand why this is happening, as it is formatted exactly the same as the other <select>
inputs. I've made sure that the $_POST assignment in the attached script is referencing the correct element name, and that the option values are correct in the HTML.
The code for the entire form is here: https://pastebin.com/52xtECCT
Here is the code for the <select>
element:
<td>Team to Represent:</td>
<td><select name="txtTeamType" id="txtTeamType">
<?php
$resultSet = $conn->query("SELECT intTypeofTeamID, strTypeofTeam FROM TTypeofTeams");
while ($rows = $resultSet->fetch_assoc())
{
$intTypeofTeamID = $rows['intTypeofTeamID'];
$strTypeofTeam = $rows['strTypeofTeam'];
echo "<option value='$intTypeofTeamID'>$strTypeofTeam</option>";
}
?>
</select>
</td>
</tr>
And here is the code for the variable assignment. This is the code that throws the error: $intTypeofTeamID = $_POST["txtTeamType"];
Thanks for any help, I really appreciate it.