I am new to PHP. This is my code from our mailing.php. When a user submits a request, there are 5-7 select-able fields and 20-25 fields that end up not being selected. The o
Just before foreach loop you should use this
$_POST = array_filter($_POST);
Another option is to use a conditional inside foreach loop
foreach($_POST as $key=>$value) if ($value != '' && $value != null) $body .= $key . ": " . $value . "\r\n";