bberry91
18 May 2011, 09:12 AM
i am printing out the fields that were left empty, or if
$error['fieldname'] = 'Flagged';
then i want to print the field name that is either incorrect, or empty. here is what i have at the moment:
<?
$reqfields = array('FName','LName');
$reqfieldnames = array('First name','Last name');
for ($i=0; $i<sizeof($reqfields); $i++) {
if (empty($i)) {
echo $reqfieldnames[$i];
}
}
?>
i feel like there is a easier way to do this... also, it only print out First Name. maybe print out the name or id of the field?
i could also check if the error of the field name at i is set to flagged... any ideas or suggestions are much appreciated!
$error['fieldname'] = 'Flagged';
then i want to print the field name that is either incorrect, or empty. here is what i have at the moment:
<?
$reqfields = array('FName','LName');
$reqfieldnames = array('First name','Last name');
for ($i=0; $i<sizeof($reqfields); $i++) {
if (empty($i)) {
echo $reqfieldnames[$i];
}
}
?>
i feel like there is a easier way to do this... also, it only print out First Name. maybe print out the name or id of the field?
i could also check if the error of the field name at i is set to flagged... any ideas or suggestions are much appreciated!