I have a stack of 'Select' menus / dropdowns on a PHP form on my website.
I'd like to check an option on each menu has been selected before processing the rest of the form, and wondered if I could loop through all of the fields with PHP?
Started with something like the following, but got a bit lost:
foreach($_POST as $key => $val){
//$errormsg.= $key." - ".$val."\n";
if ($_POST['FIELD_NAME_HERE']){
$FIELD_NAME_HERE_field = $_POST['FIELD_NAME_HERE'];
} else {
$errormsg.= "<li>Please select from the FIELD_NAME_HERE options</li>";
}
}
Is this possible? And if so, how do I achieve this?
Thank you.