The idea of this script is to post the goalscoorers of a footballmatch. When the user fills in the amount of goals, boxes will show asking the user to fill in the scoorers name.
At the top of the page, radiobuttons is shown to let the user choose wich part to edit.
The problem is that when I choose the 'A-team radiobutton' and fill in the endresult, press the 'Next-button', the page reloads and stops the name boxes to appear. Why is this happening?
This script is only working if u shoose the A-team radiobutton:
<!-- Here u choose witch part to edit -->
<form action="" method="POST">
<div align="center">
Notes:
<input type="radio" name="radiobutton" value="1"<? //if ($radiobutton == "1") echo("checked");?>>
Nyheter:
<input type="radio" name="radiobutton" value="2"<? //if ($radiobutton == "2") echo("checked");?>>
<br> A-team:
<input type="radio" name="radiobutton" value="A"<? //if ($radiobutton == "A") echo("checked");?>>
B-team:
<input type="radio" name="radiobutton" value="B"<? //if ($radiobutton == "B") echo("checked");?>>
D-team:
<input type="radio" name="radiobutton" value="D"<? //if ($radiobutton == "D") echo("checked");?>>
<br>
<input name="skicka" type="submit" id="skicka" value="Nästa...">
<br>
</div>
<hr size="1" noshade>
</form>
<? //Depending on wish selection made, following form is shown
if (isset($_POST['skicka'])) {
if ($_POST['radiobutton'] == "A") {
?>
<form name="Målgörare" method="post" action="">
<input name="endresult" type="text" id="endresult" value="<? if (isset($_POST['endresult'])) print $_POST['endresult']; else { print '0-0'; } ?>" size="3" maxlength="5">
<input name="save" type="submit" id="save" value="Next..."><br>
<?
//Check the amount of goals made and makes x-amount of boxes
if (isset($_POST['save'])) {
$save = explode("-", $_POST['endresult']);
if ($save[0] != 0){
print '<b>Hemmalagets målgörare:</b><br>';
$a = 0;
while ($a < $save[0]) {
$a++;
print $a . ':' . ' ' . '<input type="text" name="hscoorer[]">' . '<br>';
}
}
if ($save[1] != 0){
print '<b>Bortalagets målgörare:</b><br>';
$b = 0;
while ($b < $save[1]) {
$b++;
print $b . ':' . ' ' . '<input type="text" name="ascoorer[]">' . '<br>';
}
}
}
?>
<input name="sendRef" type="submit" id="sendRef" value="Spara">
</form><br>
<?
If (isset($_POST['hscoorer'])) {
$score = $_POST['hscoorer'];
$hgoalscoorers = implode(", ", $score);
print '<br><br>' . $ghoalscoorers;
}
} //ends "if (isset($_POST['skicka']))"
}//ends "if ($_POST['radiobutton'] == 3)"
?>