我想用PHP檢查我的輸入表單。表單的多維數組
而我想用虛假輸入框名稱和原因填充數組。
但我不知道如何得到它多維。
例如
$false = array();
if (!isset($_POST['name']) OR $_POST['name'] == "") {
array_push($false, "name");
//and here I want to to get a multi-dimension array and put the reason of the fales the the arraykey name
//e.g. Sorry the name is missing!
}
if (strlen($_POST['name']) < 3) {
array_push($false, "name");
//and here I want to to get a multi-dimension array and put the reason of the fales the the arraykey name
//e.g. Sorry the name is to short!
}
現在我想得到(如果輸入表單名稱在提交後沒有任何意義)例如
false
(
[0] => name
(
[0] => Sorry the name is missing!
[1] => Sorry the name is to short!
[2] => etc etc
)
[1] => etc
(
[0] => etc etc
)
)
有人能幫我嗎?
$ false = array(); $ false [] = $ _POST; 這樣的事情? – DarkMantis 2012-01-04 13:00:51
在我的例子中,我在數組中寫入「false」輸入「name」,現在我想把原因放到數組kay「name」中。 – fteinz 2012-01-04 13:11:17
$ false = array(); $ false ['name'] [] = $ _POST ['name'];將工作 – DarkMantis 2012-01-04 14:40:08