I have a form with 4 required inputs. They are being passed into the url if they are missing.
If all 4 is missing it’ll look like:
?required[0]=field_name&required[1]=field_email&required[2]=field_number&required[3]=field_desc
If the first one field_name is missing, the array will be pushed forward one, so field_email will be [0]. Which means that the array is always in the 0,1,2,3 order.
What I want to find out is how can I retrieve the information so I can put a red border around the input that is missing? What I need is something like:
while ($i=0,$i<=3,$i++) {
do ($requiredArray[i] == 'field_email') {
echo '<script type="text/javascript">$("#name)".css("border","1px solid #ff0000");</script>';
} while ();
endwhile;
}
You can also use
array_searchin php as follows :if the value is greater than or equal to zero then you can do the processing.
Like, you can have all the values in a array variable say
$required_arrayand you can useforeachloop like as follows: