I have searched for a solution to this problem, the closest I came was this answer, however it does not provide sufficient explanation.
The following button contains BOTH a tournaments name and a tournaments number.
<input type="submit" name="<?php echo $tournament.$weekNumber ?>" />
Tournaments can VARY i.e. have different names & round numbers. When the button is clicked and the form is submitted how do you get the tournament name and round number contained in the button name?
I have tried
foreach($_POST as $name => $content) {
//echo "The TOURNAMENT NAME IS: $name <br>";
$tournament = $name;
}
The problem...it gives me the round number AND tournament name concatenated....
I could use substr() to separate the tournament and round but it wont work since tournament names and round numbers can vary...
I need BOTH the tournament name and Week Number which is concatenated in the buttons name name="<?php echo $tournament.$weekNumber ?>"
[]to submit an array. This might be a lot easier to handle than splitting a string. E.g.<button type="submit" name="t1[17]" value="foo">Submit</button>would result in something like$_POST['t1'][17] == 'foo'.