嗨Im從多維數組中傳遞表單值。我傳遞的價值觀是這樣的。第三個值從html表單傳遞。PHP:多維數組foreach回聲表單傳遞第三個值
<input type=\"text\" name=\"input[".$row[Id]."][".$record[Name]."][]\" size=\"2\" />
input[1][1][]
input[1][2][]
input[1][3][]
input[2][1][]
input[2][2][]
input[2][3][]
然後我嘗試對它們進行foreach但我被卡住了。
foreach($_POST[input] as $name => $value){
foreach($value as $inner_value =>$value){
foreach($value as $inner_inner_value => $value){
echo "Menu: {$name} submenu: {$inner_value} subsubmenu :{$inner_inner_value}\n<br><br>";
}
}
}
它是與此相呼應:
Menu:1 submenu: 1 subsubmenu: 0
Menu:1 submenu: 2 subsubmenu: 0
Menu:1 submenu: 3 subsubmenu: 0
Menu:2 submenu: 1 subsubmenu: 0
Menu:2 submenu: 2 subsubmenu: 0
Menu:2 submenu: 3 subsubmenu: 0
但我要實現這個
Menu:1 submenu: 1 subsubmenu: value entered into form field.
Menu:1 submenu: 2 subsubmenu: value entered into form field.
Menu:1 submenu: 3 subsubmenu: value entered into form field.
Menu:2 submenu: 1 subsubmenu: value entered into form field.
Menu:2 submenu: 2 subsubmenu: value entered into form field.
Menu:2 submenu: 3 subsubmenu: value entered into form field.
第三值從HTML張貼基本上我不知道我怎麼可以傳遞第三值數組使用表單。
<input type="text" name="input[THIS IS OK][THIS IS OK][value ENTERED in FORM FIELD???]" size="2" />
感謝這麼簡單:) – user1508136