我要从表单中添加一系列项目,如果所有项目都是空的,我想执行一些验证并将其添加到错误字符串中。所以我有:
$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>';