Basically, I have 1 selection box at the top of my page, called cups. There are 8 teams assigned to each cup. Upon selecting a cup and hitting submit I want all of the teams associated in that cup to fill 8 selection boxes elsewhere on the page allowing the user to choose which team plays the other.
I've attempted many things, and I have got to the point where I can echo the teams, they simply aren't being echoed into the selection boxes in a different div on the same page
<input type="submit" name="submit" value="Generate" class="submit">
<?php
if (isset($_POST['submit'])) { //checking if submit button was clicked
include_once 'action/dbcon.php';
$cname = $_POST['cupname'];
if (empty($cname)) {
header("Location: ../table.php?field=empty"); //return them if fields are empty
exit();
} else {
$sql = "SELECT * FROM teams WHERE cup_name='$cname'";
$show_teams = mysqli_query($conn, $sql);
if (!$show_teams) {
echo "Could not load teams! " . "(" . mysqli_error($conn) . ")";
}
while ($team = mysqli_fetch_assoc($show_teams)) {
echo $team["team_name"];
}
}
echo "dank";
}
?>
</form>
<div class="seed-container">
<div class="column-1">
<form class="seed-form">
<select name="team" required>
<option></option>
</select>
<select name="team" required>
<option></option>
</select>
So, I'm echoing the right results, just not as options in the selection boxes where I want them