Как сделать переключатели, выбрать поля и флажки обязательных полей в форме?

Я настроил свой код так, чтобы он потребовал все поля в форме, но по какой-то причине он применяется только к типам ввода текста, электронной почты и пароля. Итак, мой вопрос в том, как я могу получить переключатели, флажки и флажок, чтобы также быть обязательными полями в форме? Вот мой код:

<form action="" method="post"> <ul id="register"> <li> <input type="text" name="first_name" placeholder="First Name"> </li> <li> <input type="text" name="last_name" placeholder="Last Name"> </li> <li> <input type="email" name="email" placeholder="Email"><br><br> </li> <li> <input type="password" name="password" placeholder="Password"> </li> <li> <input type="radio" name="sex" value="male">Male <input type="radio" name="sex" value="female">Female </li> <li> Birthday: <select name="month"> <option value="January">January</option> //all the other month options </select> <select name="day"> <option value="1">1</option> //all the other days of the month </select> <select name="year"> <option value="2013">2013</option> //ton of year options here </select><br><br> </li> <li> <input type="checkbox" name="terms_of_service" value="termsofservice">Terms of Service<br><br> </li> <li> <input type="submit" name="registrationform" value="Sign up"> </li> </ul> </form> <?php if (empty($_POST) === false) { $required_fields = array('first_name', 'last_name', 'email', 'password', 'sex', 'birthday', 'terms_of_service'); foreach ($_POST as $key=>$value) { if (empty($value) && in_array($key, $required_fields) === true) { $errors[] = 'You didn\'t fill in all of the categories.'; break 1; } } } print_r($errors); ?> 

Solutions Collecting From Web of "Как сделать переключатели, выбрать поля и флажки обязательных полей в форме?"