I have been searching and trying to find what is wrong with my code for quite a while and I wouldn't be asking this if I still had no idea what is wrong with my code. Essentially I am echoing a get form, with a php script as it's action like this:
<?php
//Add a team list and list members to each team.
$memq = "SELECT members.id, teams.team_name, teams.stage, teams.points, members.member1 FROM members INNER JOIN teams ON teams.team_name=members.team_name";
$memres = mysql_query($memq) or die ('Couldnt display members'.mysql_error());
echo "<br> Teams, Stage & Members: <br>";
while ($memrow = mysql_fetch_assoc($memres))
{
$team_name = $memrow['team_name'];
echo "<form method='get' action='addOne.php'><input type='hidden' name='team_name' value='$team_name'><input type ='submit' name='team_name' value='+1'></form> ";
echo "<form method='get' action='addTwo.php?team_name=$team_name' value='<?php echo $team_name;?>'><button type ='submit'>+2</button></form> ";
echo "<form method='get' action='addTen.php?team_name=$team_name' value='<?php echo $team_name;?>'><button type ='submit'>+10</button></form> ";
echo $memrow['id'] . " | " . $memrow['team_name'] . " | " . $memrow['stage'] . " | " . $memrow['member1'] . " | " . $memrow['points'] . "<br>";
}
?>
I have been playing around with it and have tried quite a variety of things (having the value =
field in the form declaration and other such), but essenially when I check the inspector in the browser it says this:
<form method="get" action="addOne.php?team_name=asda">
<input type="hidden" value="asda">
<input type="submit" value="+1"></form>
So you can see that the value is actually set, but the form submission must not be working because the if
statement in addOne.php ( if (isset($_GET['team_name']))
) is always returning false.
Am I missing something very simple here? Help appreciated, thanks in advance. :)
</div>