Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
|
the mail function accepts another field called "header" which allows you to specify the header for the email being sent. You can use this to set who the email is from. Here's the code
<?php
if(isset($_POST['submit'])) {
$to = "mmcx200909@yahoo.com";
$subject = "MAJOR FORM";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
$header = "FROM: $email_field";
echo "Your e-mail has been successful sent! You may close out of your browser.";
mail($to, $subject, $body, $header);
} else {
echo "blarg!";
}
?>
|