我从一个表单中添加了一个项数组,如果它们都是空的,我想执行一些验证并添加一个错误字符串。所以我有:
$array = array(
'RequestID' => $_POST["RequestID"],
'ClientName' => $_POST["ClientName"],
'Username' => $_POST["Username"],
'RequestAssignee' => $_POST["RequestAssignee"],
'Status' => $_POST["Status"],
'Priority' => $_POST["Priority"]
);
然后,如果所有的数组元素都是空的,那么执行:
$error_str .= '<li>Please enter a value into at least one of the fields regarding the request you are searching for.</li>';