Hi everyone.
I read somewhere that Google crawler triggers the contact form to send blank emails.
I believe a validation of the fields will stop this from happening, but I couldn’t solve this problem to save my life, my php skills are very poor.
Here is the code, I hope someone can help, any help is appreciated.
[php]<?php
ob_start();
session_start();
include(‘class.phpmailer.php’);
include(‘admin/includes/config.php’);
$name=isset($_POST[‘name’]) ? addslashes($_POST[‘name’]) : ‘’;
$email=isset($_POST[‘email’]) ? addslashes($_POST[‘email’]) : ‘’;
$phone=isset($_POST[‘phone’]) ? addslashes($_POST[‘phone’]) : ‘’;
$comment=isset($_POST[‘comment’]) ? addslashes($_POST[‘comment’]) : ‘’;
$row=mysql_fetch_array(mysql_query("SELECT * FROM `fds_tbladmin` WHERE `id`='1'"));
$admin_email=$row['email'];
$Subject1 ="Someone Has Contacted You";
$TemplateMessage.="<br/><br />Hi Admin";
$TemplateMessage.="";
$TemplateMessage.="<br><br>";
$TemplateMessage.=" Name :".$name;
$TemplateMessage.="<br><br>";
$TemplateMessage.="Email :".$email;
$TemplateMessage.="<br><br>";
$TemplateMessage.="Phone :".$phone;
$TemplateMessage.="<br><br>";
$TemplateMessage.="Comment :".$comment;
$TemplateMessage.="<br><br><br/>Thanks & Regards<br/>";
$TemplateMessage.="Flash Driving School";
$TemplateMessage.="<br><br><br>This is a post-only mailing. Replies to this message are not monitored
or answered.";
$mail1 = new PHPMailer;
$mail1->FromName = "flashdrivingschool.com";
$mail1->From = "[email protected]";
$mail1->Subject = $Subject1;
$mail1->Body = stripslashes($TemplateMessage);
$mail1->AltBody = stripslashes($TemplateMessage);
$mail1->IsHTML(true);
$mail1->AddAddress($admin_email,"flashdrivingschool.com");//[email protected]
$mail1->Send();
header(‘location:thankyou.php’);
exit();
?>[/php]