On a previous page, I have gotten the names and the number of playeys values from the user.
I wish to fill them into an array. Here is my code so far:
<?php
$numberOfPlayers = $_POST['numberOfPlayers'];
$counter = 1;
$playerName = array();
while($counter<=$numberOfPlayers-1){
$playerName[$counter-1]= $_POST[$counter];
$counter=$counter+1;
}
print_r($playerName);
?>
However it is throwing out an error saying "Undefined offset: 1 in C:\wamp\www\test.php on line 8".
Any help would be much appreciated.
Thanks
$_POST['1']does not exist.