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 (but $fieldArray[] does show the contents. Any Ideas? I know it's bound to be something simple. /Thanks
UPDATE:
I have changed the line
if ( in_array("frm_companyName", $fieldArray)) {
$errorArray[] = "Company Name";
}
to
if ( in_array("frm_companyName", $fieldArray)) {
echo " ---- Working ---- ";
}
to just echo out a message but it isn't echoing so there is definitely something wrong with the check i.e. the in_array.
var_dump($fieldArray)
say? – Ja͢ck Aug 19 '13 at 2:36