Hi all
I have this problem where I receive blank forms. I think its either caused by robots, or maybe people arrive on the wrong page from SE's.
Do you know of any little snippets of code that I can stick inside the php form so that it won't send the email out if the customer's email isn't there or something?
What is the standard protocol for stopping blank emails? I am kind of new to this.
Thanks for any feedback in advance,
Cheers,
Doug
stop forms being sent if blank
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: stop forms being sent if blank
Check the form fields to see if they are empty:
Code: Select all
$errors = '';
if (isset($_POST['email']) && $_POST['email']) {
$email = preg_replace('/[^a-zA-Z0-9\_\-\.\@]/', '', $_POST['email']);
} else {
$errors .= 'Email required. ';
$email = '';
}(#10850)
Re: stop forms being sent if blank
thanks for that! Ill give it a whirl