Christopher
New member
Ok, I already have multiple PHP scripts running that properly send me the visitors message but there is a small problem in them that I need help/ advice to fix.
I want the script to pull the persons email address, and possibly name, and enter is as the sender (From: ) of the message. I've tried headers and all that but it just wont work for me. By the way Yahoo! is my host and when the visitor sends a message it shows up as From: [email protected] To: [email protected]
If it is possible can anyone help fix my script to allow the From: field to be from the person submitting the form?
HERE IS MY CODE:
<?php
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "Feedback for mysite.com";
$info_field = $_POST['info'];
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$comment = $_POST['comment'];
$issue_field = $_POST['issue'];
$suggestion_field = $_POST['suggestion'];
$check_box = $_POST['check'];
$body = "($name_field) $info_field $check_box\n\n Site Issue: $issue_field\n Suggestion: $suggestion_field\n\n Comment: $comment\n\n Reply to: $email_field";
echo "Data is being submitted to $to!";
mail($to, $subject, $body);
header( "Location: http://www.mysite.com/contact_page/thankyou.html" );
} else {
echo "You shouldn't be here!";
}
?>
NOTE: Pay no attention to the echo fields.
Additional parameters such as $headers and $heads don't seem to work. I've tried them already (Not the best at them though). I'm thinking Yahoo may be blocking these add-ons for some reason, does anyone know? are there anyways around this?
I want the script to pull the persons email address, and possibly name, and enter is as the sender (From: ) of the message. I've tried headers and all that but it just wont work for me. By the way Yahoo! is my host and when the visitor sends a message it shows up as From: [email protected] To: [email protected]
If it is possible can anyone help fix my script to allow the From: field to be from the person submitting the form?
HERE IS MY CODE:
<?php
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "Feedback for mysite.com";
$info_field = $_POST['info'];
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$comment = $_POST['comment'];
$issue_field = $_POST['issue'];
$suggestion_field = $_POST['suggestion'];
$check_box = $_POST['check'];
$body = "($name_field) $info_field $check_box\n\n Site Issue: $issue_field\n Suggestion: $suggestion_field\n\n Comment: $comment\n\n Reply to: $email_field";
echo "Data is being submitted to $to!";
mail($to, $subject, $body);
header( "Location: http://www.mysite.com/contact_page/thankyou.html" );
} else {
echo "You shouldn't be here!";
}
?>
NOTE: Pay no attention to the echo fields.
Additional parameters such as $headers and $heads don't seem to work. I've tried them already (Not the best at them though). I'm thinking Yahoo may be blocking these add-ons for some reason, does anyone know? are there anyways around this?