Проверка пустых / радиополей – Php

<?php $name = $_POST["name"]; $email = $_POST["email"]; $gender = $_POST["gen"]; $age = $_POST["age"]; $comments = $_POST["comments"]; if(empty($_POST["name"])){ echo "empty name"; } if(empty($_POST["email"])){ echo "empty email"; } /// if(empty($_POST["gen"])){ echo "empty gender"; } if(empty($_POST["comments"])){ echo "empty comments"; } if(!isset($_POST['submit'])) { ?> <html> <head> <title>Lab6 : P1</title> </head> <body> <fieldset> <legend><h4>Enter your information in the fields below</h4></legend> <form name="info" method="post" action="<?php echo $PHP_SELF;?>" method="post"> <strong>Name:</strong> <input type="text" name="name" id="name" /><br> <strong>Email:</strong> <input type="text" name="email" id="email" /><br> <br> <strong>Gender</strong><br> <input type="radio" name="gen" value="Male">Male</input><br> <input type="radio" name="gen" value="Female">Female</input><br> <br> <select name="age"> <option value="Under 30">Under 30</option><br> <option value="Between 30 and 60">Between 30 and 60</option><br> <option value="60+">60+</option> </select> <br> Comments: <textarea name="comments" cols="20" rows="5"> </textarea> </fieldset> <input type="submit" name="submit" value="Submit my Information" /> </form> </body> </html> <? } else { echo "Thank you, ".$name." for your comments: " . "<strong>" . $comments . "</strong>"; echo "<br>We will reply to you at:" . "<em>" . $email . "</em>"; } ?> 

Мне нужно это, чтобы проверить поля: имя, адрес электронной почты, комментарии для пустых строк (не разрешены) и не разрешать не выбранные переключатели для выбора пола и возраста.

Может кто-нибудь помочь

Solutions Collecting From Web of "Проверка пустых / радиополей – Php"