I have a form with a lot of textboxes and text fields. Most of them are not required to fill by the user. Is there any simple way to filter out those fields and boxes which the user left empty so the mail() sends only filled lines (text fields or textboxes)?
Thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a form with a lot of textboxes and text fields. Most of them are not required to fill by the user. Is there any simple way to filter out those fields and boxes which the user left empty so the mail() sends only filled lines (text fields or textboxes)?
Thanks for your help.
In your processor.php file, change something like this
mail("you@yoururl.com","phpFormGenerator - Form submission","Form data:
Name: " . $_POST . "
State of residence: " . $_POST . "
Email: " . $_POST . "
powered by phpFormGenerator.
");
to something like this
$message="Form data:";
if($_POST) {$message.="Name: " . $_POST . "\r\n"}
if($_POST) {$message.="State of residence: " . $_POST . "\r\n"}
if($_POST) {$message.="Email: " . $_POST . "\r\n"}
$message.="powered by phpFormGenerator.";
mail("you@yoururl.com","phpFormGenerator - Form submission",$message);