Checking input from a radio button or a single select : Radio Button « Form « PHP






Checking input from a radio button or a single select

 
<?php
$options = array('option 1', 'option 2', 'option 3');

$valid = true;
if (is_array($_GET['input'])) {
    $valid = true;
    foreach($_GET['input'] as $input) {
        if (!in_array($input, $options)) {
           $valid = false;
        }
    }
    if ($valid) {
       
    }
}
?>
  
  








Related examples in the same category

1.Validating a radio button
2.Form radio buttons