Hello everyone,
I wrote a PHP contact script with form validation in it and everything, and it works. The thing is, I want to be able to hit reply from the message that was sent to me. I'm not sure how to make the email look like it was sent by the person who wrote the message. I assume this would be done with header definitions, but I'm not sure how to do this. Can anyone help me out? I just need a rough idea.
PHP Code:<?php
/* GET VARIABLES */
$name = trim($_POST['name']);
$address = trim($_POST['email']);
$number = trim($_POST['phone']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$to = "me@onlyme.com";
/* TESTS */
if ($name == "your full name") {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=2#form\">";
} else if ($address == "your email address") {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=2#form\">";
} else if ($number == "phone number with area code") {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=2#form\">";
} else if ($subject == "what is this all about?") {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=2#form\">";
} else if ($to == "questions? comments? need a website? do tell us!") {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=2#form\">";
} else {
/* CREATE MESSAGE */
$email = "";
$email .= "From: ";
$email .= $name . " <" . $address . ">";
$email .= "\r\n";
$email .= "Phone: ";
$email .= $number;
$email .= "\r\n\r\n";;
$email .= $message;
/* SEND */
mail($to, $subject, $email);
/* REDIRECT */
if (mail){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=1#form\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php/?s=2#form\">";
}
}
?>





Bookmarks