I have a simple contact form on a website that was moved to new server, and now they are receiving blank entries every day.
Here is the form code:
<?php
$EmailFrom = "info@mywebsite.com";
$EmailTo = "guyf@mywebsite.com";
$Subject = "Website Contact";
$Name = Trim(stripslashes($_POST['Name']));
$Company = Trim(stripslashes($_POST['Company']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "The following is a contact us form submitted from your website.";
$Body .= "\n";
$Body .= "\n";
$Body .= "NAME: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "COMPANY: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "EMAIL: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "MESSAGE: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
And here are the PHP errors that I'm getting, which don't make sense to me since I entered information on those lines. Could it be the blank entry?
[04-Dec-2015 11:41:09 America/Denver] PHP Notice: Undefined index: Name in /home6/mywebsite/public_html/contact-f-2/contactengine.php on line 6
[04-Dec-2015 11:41:09 America/Denver] PHP Notice: Undefined index: Company in /home6/mywebsite/public_html/contact-f-2/contactengine.php on line 7
[04-Dec-2015 11:41:09 America/Denver] PHP Notice: Undefined index: Email in /home6/mywebsite/public_html/contact-f-2/contactengine.php on line 8
[04-Dec-2015 11:41:09 America/Denver] PHP Notice: Undefined index: Message in /home6/mywebsite/public_html/contact-f-2/contactengine.php on line 9
Thoughts?