lesh
01-15-2012, 08:57 AM
I am working on getting a contact form up and running for a website and have taken an example of someone else's. Only problem is I don't know anything about php so getting the form to work is proving difficult.
I have highlighted the lines I am unsure of with orange.
I don't know what I am supposed to put instead of junk@junk.om
Also, I am unsure how to change the URL to my contactthanks.html page. Everything I have tried will not work.
<?php
// CHANGE THE VARIABLES BELOW
$EmailFrom = "junk@junk.com";
$EmailTo = "aharper2000@hotmail.com";
$Subject = "Contact Form Submission";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
Any help would be appreciated.
Here is a link to what I've got working so far: http://ah.mjtippet.com/contact.html
I have highlighted the lines I am unsure of with orange.
I don't know what I am supposed to put instead of junk@junk.om
Also, I am unsure how to change the URL to my contactthanks.html page. Everything I have tried will not work.
<?php
// CHANGE THE VARIABLES BELOW
$EmailFrom = "junk@junk.com";
$EmailTo = "aharper2000@hotmail.com";
$Subject = "Contact Form Submission";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
Any help would be appreciated.
Here is a link to what I've got working so far: http://ah.mjtippet.com/contact.html