Can't you check the other fields the same way you check $EmailFrom? If any one of them fails the validation, $validationOK will be set to false, and if $validationOK equals false, the script exits.
For example...
code:
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if ($Name == "") $validationOK=false;
if ($Query == "") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}