Check whether the field is empty before adding it to the mail.
foreach($fields as $a => $b) {
if (!empty($_REQUEST[$a])) {
$body .= sprintf("%20s:%s\n",$b,$_REQUEST[$a]);
}
}
0
solved How to drop empty responses in an array of fields?