Email forwarding Form HELP
Posted: Fri Sep 03, 2010 10:03 am
Okay I have no idea why this doesn't work!! Anyone help?
It sends some of them depending on what email you put in the form!! which doesn't make sense because they all are valid emails and get through the validation!
Eg. sends when you put your email is name@live.co.uk but not 1111@live.co.uk
can look at it working on www.bishcycles.co.uk on the contact page.
FORM:
<form method="POST" action="cont.php" style="text-align:center" onsubmit="return validateForm()" name="cont">
<p>Name:
<input type="text" name="Name" />
Contact Number:<br />
<input type="text" name="Number" />
Email:
<input type="text" name="EmailFrom" />
Inquiry Details:
<textarea name="Comments" cols="45" rows="5"></textarea>
<input type="submit" name="submit" value="Submit" />
</p>
</form>
PHP:
<?php
if ($_SERVER['HTTP_REFERER'] != 'http://bish.herobo.com/contact.php'){
echo "Invalid referer";
die;
}
$EmailFrom = $_POST['EmailFrom'];
$Name = $_POST['Name'];
$Comments = $_POST['Comments'];
$Number = $_POST['Number'];
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $EmailFrom;
$Body .= "\n";
$Body .= "Contact Number: ";
$Body .= $Number;
$Body .= "\n \n";
$Body .= "Inquiry Details: ";
$Body .= "\n";
$Body .= $Comments;
$Body .= "\n";
if (preg_match('#^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z]{2,6}$#', $EmailFrom)) {
mail('MYEMAIL@hotmail.com', 'BishCycles Inquiry', $Body, 'From: <'.$EmailFrom.'>');
header('Location: sucess.php');
} else {
header('Location: error.php');
}
?>
Thanks
It sends some of them depending on what email you put in the form!! which doesn't make sense because they all are valid emails and get through the validation!
Eg. sends when you put your email is name@live.co.uk but not 1111@live.co.uk
can look at it working on www.bishcycles.co.uk on the contact page.
FORM:
<form method="POST" action="cont.php" style="text-align:center" onsubmit="return validateForm()" name="cont">
<p>Name:
<input type="text" name="Name" />
Contact Number:<br />
<input type="text" name="Number" />
Email:
<input type="text" name="EmailFrom" />
Inquiry Details:
<textarea name="Comments" cols="45" rows="5"></textarea>
<input type="submit" name="submit" value="Submit" />
</p>
</form>
PHP:
<?php
if ($_SERVER['HTTP_REFERER'] != 'http://bish.herobo.com/contact.php'){
echo "Invalid referer";
die;
}
$EmailFrom = $_POST['EmailFrom'];
$Name = $_POST['Name'];
$Comments = $_POST['Comments'];
$Number = $_POST['Number'];
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $EmailFrom;
$Body .= "\n";
$Body .= "Contact Number: ";
$Body .= $Number;
$Body .= "\n \n";
$Body .= "Inquiry Details: ";
$Body .= "\n";
$Body .= $Comments;
$Body .= "\n";
if (preg_match('#^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z]{2,6}$#', $EmailFrom)) {
mail('MYEMAIL@hotmail.com', 'BishCycles Inquiry', $Body, 'From: <'.$EmailFrom.'>');
header('Location: sucess.php');
} else {
header('Location: error.php');
}
?>
Thanks