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]);
}
}
More Related Contents:
- php form send email
- PHP Upload fails for Video but not Image [closed]
- Get $_POST from multiple checkboxes
- How to get a form input array into a PHP array
- Understanding the “post/redirect/get” pattern
- How to set HTML value attribute (with spaces)
- Send value of submit button when form gets posted
- PHP: check if any posted vars are empty – form: all fields required
- Submit an HTML form with empty checkboxes
- Serializing and submitting a form with jQuery and PHP
- Form input field names containing square brackets like field[index]
- PHP form send email to multiple recipients
- How to add a delete button to a PHP form that will delete a row from a MySQL table
- Why is textarea filled with mysterious white spaces?
- getting a checkbox array value from POST
- How to redirect back to form with input – Laravel 5
- How to set a class attribute to a Symfony2 form input
- Laravel form html with PUT method for PUT routes
- PHP File Upload
- Storing Form Data as a Session Variable
- Back button re-submit form data ($_POST)
- Print $_POST variable name along with value
- GET vs. POST Best Practices
- PHP $_POST not working? [duplicate]
- send checkbox value in PHP form
- Forbidden Error When Submitting Simple PHP Form
- PHP ZIP files on the fly
- POST arrays not showing unchecked Checkboxes
- multi-dimensional array post from form
- Undefined index error PHP