I have the following code to ensure that the form does not have any unfilled textboxes and selected boxes
$required_fields = array ('menu_name','visible','position');
foreach($required_fields as $fieldname)
{
if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]) )
{
$errors [] = $fieldname;
}
}
Where menu_name, visible and position are variables that are received through the post method
Am having a problem when the value of 'visible' is zero (0) as it creates an entry into the error array. How can I avoid this as I presume when the value is 0 then it is considered not set by the isset function.