Hi,
I have a form, with a number of fields that I want to make sure are filled in. I have 2 text boxes, that corrispond to each other.
field_1 and field_a,
field_2 and field_b,
field_3 and field_c,
etc...
If '1' is filled in, then 'a' needs to be, and if '2' is, then 'b' needs to be, etc. However the number of fields will vary depending on the user. Some people will have 1 or 2 fields, some will have 20. I know I could just code
if ($field_1 && !field_b) {
feedback .= 'Error';
return false;
} else...
then do
if (field_2 && !$field_b) {
feedback .= 'Error';
return false;
} else...
and do it for field 3,4....20 etc, but it will make the coding huge, and if someone has only 4 fields, and the code is checking for field20 it will fail. Is there anyway I can just check the fields if they exist? Maybe something like
if (field[] && !field[]){
feedback .= 'Error';
return false
}....
Many Thanks
Ben