if ( $_POST["type"] == "rate" and ($_POST["rate"] != "" or $_POST["rate2"] != "" or $_POST["rate3"] != "" or $_POST["rate4"] != "" )){do the db insert} else ...