在上一頁中,我已經獲得用戶的名稱和數量的playeys值。試圖填充一個PHP數組
我希望將它們填充到數組中。這是我到目前爲止的代碼:
<?php
$numberOfPlayers = $_POST['numberOfPlayers'];
$counter = 1;
$playerName = array();
while($counter<=$numberOfPlayers-1){
$playerName[$counter-1]= $_POST[$counter];
$counter=$counter+1;
}
print_r($playerName);
?>
但是它拋出一個錯誤,說 「未定義抵消:1 C:\ WAMP \ WWW \ test.php的第8行」。
任何幫助將不勝感激。
謝謝
'$ _POST ['1']'不存在。 – Wrikken