I put together a simple PHP email form for a website, but it keeps sending blank emails every so often. Most of the the fields are \"required\" and I was using a captcha sys
You will want to do validation on your PHP.
http://www.w3schools.com/php/php_form_validation.asp
Basically you will want to do the following:
Security
Validation
if (!empty($email)){
//your code to send email
}
You could make it a little more complex if you want to check more than one thing.
$fail_validation = FALSE;
if (empty($email)){
$fail_validation = TRUE;
}
if (empty($phone)){
$fail_validation = TRUE;
}
if ($fail_validation == FALSE){
//code to send mail goes here
}
Please note, this is very basic, and you may want to consider looking into some extra functions to secure the PHP. I would also suggest using a honeypot as an extra layer of security. https://stackoverflow.com/a/22103646/2547075