Checking a menu submission value

 
if (! array_key_exists($_POST['order'], $GLOBALS['sweets'])) {
    $errors[] = 'Please choose a valid order.';
}
  
  








Related examples in the same category

1.Checking for an element with a particular key
2.Validating a drop-down menu with array_key_exists()
3.Testing for the Existence of a Key in an Array