我想用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