Blank emails

I have contact forms on my site and they are in PHP. Almost every day I receive blank email from the forms. I do not understand why this happens because each form has a filter that requires each field to be filled before the user can click “submit”.

Below is a copy of the code of one of the PHP fields and the link to my site. Can any one point me in the right direction?
Thank you,
Lee

http://www.masterfranchises.org/chock-full-o-nuts-franchise.htm

<?PHP
// grab the information from the form
$check = false;
$site = “Chockfull o’ Nuts Coffee”;
$fname = $_POST[‘FirstName’];
$lname = $_POST[‘LastName’];
$email = $_POST[‘Email’];
$wphone = $_POST[‘WorkPhoneExt’];
$hphone = $_POST[‘HomePhone’];
$mphone = $_POST[‘MobilePhone’];
$address =($_POST[‘StreetAddress’]);
$city =($_POST[‘City’]);
$country =($_POST[‘country’]);
$state =($_POST[‘State’]);
$zipcode =($_POST[‘PostalCode’]);
$time = $_POST[‘time’];
$liquid = $_POST[‘liquid’];
$net = ($_POST[‘net’]);
$contact_time = ($_POST[‘BestTimeToContact’]);
$brokersname = ($_POST[‘BrokersName’]);
$invalid = false;
//Validate information
if( (empty($fname)) || (empty($lname)) || (empty($email)) || (empty($hphone)) ){
echo "<font color=red face=Arial size=4>You have not entered the required fields, please complete the form to recieve more information about $site Franchises.<p><i><font color=navy>This page will automatically refresh. ";
echo “<META HTTP-EQUIV=‘Refresh’
CONTENT=‘3; URL=\’>”;
$invalid = true;
}

// mail user their information

$subject = “Lead Information from $site”;
$message = "

Lead Information Generated By Master Franchise Specialists:

Name: $lname, $fname
Franchise: $site
E-mail: $email
Home Phone: $hphone
Work Phone: $wphone
Mobile Phone: $mphone
Address: $address
City: $city
Country: $country
State: $state
ZipCode: $zipcode
Liquid Capital: $liquid
Net Worth: $net
Timeframe: $time
Best Contact Time: $contact_time
Broker's Name: $brokersname

Your Lead for: $lname, $fname has been recorded.


Management Solutions Provided By:	Master Franchise Specialists

";

$admin="ehiweb@gmail.com";

mail($admin, $subject, $message);
if ( $check = true )
{
//mail(“customerservice@masterfranchises.org”, $subject, $message);
mail(“franmaster@sbcglobal.net”, $subject, $message);
mail(“elisandro@hotmail.com”, $subject, $message);
}
if(!$invalid){
echo “<META HTTP-EQUIV=‘Refresh’
CONTENT=‘2; URL=index.htm’>”;
echo"<font face=Arial size=3 color=navy>Thank you for your submission, your information will be processed as soon as possible. You will be redirected in 5 seconds.";
}
?>


function mail_control($email) { 
 
	if (!eregi("^[^@]{1,64}@[^@]{1,255}$", $email)) { 
		return false; 
	} 

	$email_array = explode("@", $email); 
	$local_array = explode(".", $email_array[0]); 
	
	for ($i = 0; $i &lt; sizeof($local_array); $i++) { 
		if (!eregi("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\\.-]{0,63})|(\\"[^(\\\\|\\")]{0,62}\\"))$", $local_array[$i])) { 
		return false; 
		} 
	}   
	if (!eregi("^\\[?[0-9\\.]+\\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name 
		$domain_array = explode(".", $email_array[1]); 
		if (sizeof($domain_array) &lt; 2) { 
		return false; // Not enough parts to domain 
		} 
		for ($i = 0; $i &lt; sizeof($domain_array); $i++) { 
			if (!eregi("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { 
			return false; 
			} 
		} 
	} 
return true; 
}

You can use this function. You will give up e-mail parameters. İf your e-mail is validating, returning true at this function.

Easy come.

Hi,
Try remove the:
mail($admin, $subject, $message);

Then replace the:
if ( $check = false ) {…}
With:
if ( $invalid === true ) {
mail($admin, $subject, $message);
}

You’re validating at the Javascript level, but not the PHP level.

throw this up top.


if(!isset($_POST['FirstName'])) { die(); }

5$ says the blank email you get every day is a search engine crawling over your email page.

This function should use the following as:


<?php
if(mail_control("name@domain.com")==true){
// Your actions...
}
else
{
echo 'Please enter a valid email address.';
}
?>

I can’t see error in your mail function. Use came to be incorrect.