PHP in_array & storing values in new array
Hi basically I am storing form field names in an array. This is working
fine as I am able to print out the array and see it's contents. The
problem I am having is checking those contents and based on them storing
new values in a new array.
PHP
$required = array('frm_companyName', 'frm_hrManager', 'frm_lnManager');
$fieldArray = array();
$errorArray = array();
...
foreach ($required as $field) {
if (empty($_POST[$field])) {
$fieldArray[] = $field;
}
}
...
if (in_array("frm_companyName", $fieldArray)) {
$errorArray[] = "Company Name";
}
When I print out the $errorArray[] I am returning an empty array. Any
Ideas? I know it's bound to be something simple. /Thanks
No comments:
Post a Comment