Hi, I'm having some php trouble...
I have an online quote form which has the following code
<form method="POST" action="contact.php">
<p>Email From: <br>
<input type="text" name="EmailFrom">
<p>Name:<br>
<input type="text" name="Name">
<p>Address:<br>
<textarea name="Address"></textarea>
<p>Tel:<br>
<input type="text" name="Tel">
<p>WeddingHire:<br>
<input type="checkbox" name="WeddingHire" value="Yes">
<p>CorporateHire:<br>
<input type="checkbox" name="CorporateHire" value="Yes">
<p>Questions/Comments:<br>
<textarea name="QuestionsAndComments"></textarea>
<p><input type="submit" name="submit" value="Submit">
</form>
<?php
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "scottlarnach@hotmail.co.uk";
$Subject = "Email From Website";
$Name = Trim(stripslashes($_POST['Name']));
$Address = Trim(stripslashes($_POST['Address']));
$Tel = Trim(stripslashes($_POST['Tel']));
$WeddingHire = Trim(stripslashes($_POST['WeddingHire']));
$CorporateHire = Trim(stripslashes($_POST['CorporateHire']));
$QuestionsAndComments = Trim(stripslashes($_POST['QuestionsAndComments']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "WeddingHire: ";
$Body .= $WeddingHire;
$Body .= "\n";
$Body .= "CorporateHire: ";
$Body .= $CorporateHire;
$Body .= "\n";
$Body .= "QuestionsAndComments: ";
$Body .= $QuestionsAndComments;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
when I run this it just keeps returning the error page and not sending the message, is there something obviously wrong with this? Are any special handles required for the php mail function with freepgs?
Any help will be greatly appreciated
I have an online quote form which has the following code
<form method="POST" action="contact.php">
<p>Email From: <br>
<input type="text" name="EmailFrom">
<p>Name:<br>
<input type="text" name="Name">
<p>Address:<br>
<textarea name="Address"></textarea>
<p>Tel:<br>
<input type="text" name="Tel">
<p>WeddingHire:<br>
<input type="checkbox" name="WeddingHire" value="Yes">
<p>CorporateHire:<br>
<input type="checkbox" name="CorporateHire" value="Yes">
<p>Questions/Comments:<br>
<textarea name="QuestionsAndComments"></textarea>
<p><input type="submit" name="submit" value="Submit">
</form>
<?php
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "scottlarnach@hotmail.co.uk";
$Subject = "Email From Website";
$Name = Trim(stripslashes($_POST['Name']));
$Address = Trim(stripslashes($_POST['Address']));
$Tel = Trim(stripslashes($_POST['Tel']));
$WeddingHire = Trim(stripslashes($_POST['WeddingHire']));
$CorporateHire = Trim(stripslashes($_POST['CorporateHire']));
$QuestionsAndComments = Trim(stripslashes($_POST['QuestionsAndComments']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "WeddingHire: ";
$Body .= $WeddingHire;
$Body .= "\n";
$Body .= "CorporateHire: ";
$Body .= $CorporateHire;
$Body .= "\n";
$Body .= "QuestionsAndComments: ";
$Body .= $QuestionsAndComments;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
when I run this it just keeps returning the error page and not sending the message, is there something obviously wrong with this? Are any special handles required for the php mail function with freepgs?
Any help will be greatly appreciated