cache_dir = 'templates_c';
//Display the header
$tpl->display('header.tpl');
//Connect to MySQL
$db = new db();
$db->connect($config);
//If submit was already pressed
if(isset($_POST['submit']))
{
//Assign vars.
$name = $_POST['name'];
$company = $_POST['company'];
$email = $_POST['email'];
$address = $_POST['address'];
$country = $_POST['country'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$require = $_POST['require'];
$message = $_POST['message'];
//Changes \n to
for message.
$message = str_replace('\n','
',$message);
//Subject of message.
$subject = 'A New Lead has been Completed';
//Who it will be sent. Default from config file.
$to = $config['techemail'];
//Set as HTML email.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";
//Customize the huge message.
$message = 'Hello,
This message is to inform you that there is a new lead at your website. The information below is what the user has sent to you:
Name: '.$name.'
Company: '.$company.'
Email Address: '.$email.'
Address: '.$address.'
Country: '.$country.'
Phone: '.$phone.'
Fax: '.$fax.'
Require What
The message they have entered below is as follows: '.$message.';
//Then send the mail.
$sendmail = mail($to,$subject,$message,$headers);
//If true.
if($sendmail == true)
{
echo 'Thank you for taking the time to contact us. We will respond as soon as possible.';
}
else
{
echo 'Failed.';
}
}
//Else
{
//Display template.
$tpl->display('leads.tpl');
}
//Display footer.
$tpl->display('footer.tpl');
?>