Hi dagon,
Thanks for your response.
This is mail.php I had before
<?php
include 'bus_var.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 15 August 2007), see www.w3.org" />
<title>
Business Exchange & Real Estate Exchange - Buy or Sell a Business, Franchise or Home in Canada
</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" /><!-- Tracker Code Start -->
</head><?php get_menu(); ?>
<body>
<div id="content">
<div class="body_col1">
<div class="margin">
<img src="img/arrow_icon.png" alt="" />
</div>
<div class="cell_75per">
<div class="page_title_text">
Contact form
</div>
</div><br class="clear" />
<div class="margin">
 
</div>
<div class="fra_cell">
<?php
$errors = array();
if(empty($_POST['realname'])){
$errors[] = 'Please enter your name';
} else {
echo "";
}
if(empty($_POST['email'])){
$errors[] = 'Please enter your email';
} else {
echo "";
}
if(empty($_POST['text'])){
$errors[] = 'Please enter your comments';
} else {
echo "";
}
$emailPattern = '/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';
$subject = 'Form Submission from Business Exchange'; // Subject of email sent to you.
$emailadd = safe($POST['recipient']); // Your email address. This is where the form information will be sent.
$emailcompany = safe($POST['company']); //Company name it's coming from
$name = safe(stripslashes($POST['realname']));
$email = safe($POST['email']);
$phone = safe($POST['phone']);
$comments = safe(stripslashes($POST['text']));
$emailother = 'bcc:pam@businessexchange.ca';
$text = "Results from form $emailcompany:\n\n";
$message .= "Results from form " . $emailcompany . "\n\n";
$message .= "Name: " . $name . "\n";
$message .= "Email: " . $email . "\n";
$message .= "Phone Number: " . $phone . "\n\n";
$message .= "Message: " . $comments . "\n\n";
if (count($errors) < 1){
mail($emailadd, $subject, $message, 'From: '.$emailadd.'');
mail($emailother, $subject, $message, 'From: '.$emailother.'');
echo "<font color='red'>Thank you so much for your Inquiry. Your message was sent successfully</font>";
} else {
echo "<font color='red'>Feedback was NOT submitted. Fill in all fields</font>";
}
function safe($string)
{
$pattern = "/\r|\n|\%0a|\%0d|Content-Type😐bcc😐to😐cc:/i";
return preg_replace($pattern, '', $string);
}
?>
</div>
<!-- -->
<?php get_listings(); ?>
</div><?php get_sidebar(); ?>
</div><?php get_footer(); ?>
This one when I added suggested code:
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
?>
<?php
include 'bus_var.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 15 August 2007), see www.w3.org" />
<title>
Business Exchange & Real Estate Exchange - Buy or Sell a Business, Franchise or Home in Canada
</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" /><!-- Tracker Code Start -->
</head><?php get_menu(); ?>
<body>
<div id="content">
<div class="body_col1">
<div class="margin">
<img src="img/arrow_icon.png" alt="" />
</div>
<div class="cell_75per">
<div class="page_title_text">
Contact form
</div>
</div><br class="clear" />
<div class="margin">
 
</div>
<div class="fra_cell">
<?php
$errors = array();
if(empty(trim($_POST['realname'])) || strlen(trim($_POST['realname'])) <= 1){
$errors[] = 'Please enter your name';
}
if(empty($_POST['email'])){
$errors[] = 'Please enter your email';
} else {
echo "";
}
if(empty($_POST['text'])){
$errors[] = 'Please enter your comments';
} else {
echo "";
}
$emailPattern = '/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';
$subject = 'Form Submission from Business Exchange'; // Subject of email sent to you.
$emailadd = safe($POST['recipient']); // Your email address. This is where the form information will be sent.
$emailcompany = safe($POST['company']); //Company name it's coming from
$name = safe(stripslashes($POST['realname']));
$email = safe($POST['email']);
$phone = safe($POST['phone']);
$comments = safe(stripslashes($POST['text']));
$emailother = ''; //bcc:pam@businessexchange.ca
$text = "Results from form $emailcompany:\n\n";
$message .= "Results from form " . $emailcompany . "\n\n";
$message .= "Name: " . $name . "\n";
$message .= "Email: " . $email . "\n";
$message .= "Phone Number: " . $phone . "\n\n";
$message .= "Message: " . $comments . "\n\n";
// before you send to yourself
$message .= printf('<pre>%s</pre>',printf($errors,true));
$message .= printf('<pre>%s</pre>',printf($_POST,true));
if (count($errors) < 1){
mail($emailadd, $subject, $message, 'From: '.$emailadd.'');
echo "<font color='red'>Thank you so much for your Inquiry. Your message was sent successfully</font>";
} else {
echo "<font color='red'>Feedback was NOT submitted. Fill in all fields</font>";
}
function safe($string)
{
$pattern = "/\r|\n|\%0a|\%0d|Content-Type😐bcc😐to😐cc:/i";
return preg_replace($pattern, '', $string);
}
?>
</div>
<!-- -->
<?php get_listings(); ?>
</div><?php get_sidebar(); ?>
</div><?php get_footer(); ?>
Thanks