Hi,
I am very new to php, and have a contact form on my website (which works!).
However, when I receive the email, there is no email subject in the email header. I can see them email content fine, and the senders name, but no email Title.
Could somebody possible take a look at the code and see if they spot anything?
Thanks in advance,
This is my index.html form code
<form id="ajax-contact-form" action="javascript:alert('success!');">
<fieldset class="info_fieldset">
<div id="note"></div>
<div id="fields">
<label>Name :</label><input class="textbox" type="text" name="name" value="" /><br />
<label>E-Mail :</label><input class="textbox" type="text" name="email" value="" /><br />
<label>Message :</label>
<textarea class="textbox2" name="message" rows="5" cols="25"></textarea>
<label> </label><input class="button" type="image" src="images/sendNew.png" id="submit" value="Send Message" />
</div>
</fieldset>
</form>
This is my contact.php code...
<?php
include 'config.php';
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if($post)
{
include 'functions.php';
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$message = stripslashes($_POST['message']);
$error = '';
// Check name
if(!$name)
{
$error .= 'I think you forget to enter your name.<br />';
}
// Check email
if(!$email)
{
$error .= 'I think you forget to enter your e-mail id.<br />';
}
if($email && !ValidateEmail($email))
{
$error .= 'Invalid E-mail id !!!<br />';
}
if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());
if($mail)
{
echo 'OK';
}
}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}
}
?>
Finally this is my config.php code..
<?php
// To
define("WEBMASTER_EMAIL", 'xxxxxx@xxxxxx.com');
?>
note - I have a contact.php, config.php, functions.php and feedback.php on my webserver, I also have a few javascript files which I think are related to this form - sorry to sound really confusing but I downloaded this form with a template.
Like I said, the contact form works fine, just no subject when I get the email.
Is it something to do with $headers??
thanks again.