funlog Posted December 19, 2008 Share Posted December 19, 2008 Hi there, my first post in your fine forum, thanks for having me I set up a web page based on a template that included a contact form. The actual emailing of the form works great, but the email of the sender will always have their name and then cgi13.cgi13 after (example funlog@cgi13.cgi13). This means I don't have their proper address and cannot reply to them. I would appreciate any help I can get on this. Thanks in advance! <? // Get the variables from the form post $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $from = "From: $name\r\n"; // If there was no Subject submitted, set a default one here if (!$subject) { $subject = "Message from Website"; } // Check fields, if they're there, send the email; if not, display error page. if ($name && $email && $message) { // Put your email address in place of "email@business.com" mail("email@business.com", $subject, $message, $from); // Thank You Page header("Location: ../contact-thankyou.html"); exit; } else { // Error Page header("Location: ../contact-error.html"); exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/137665-small-problem-with-contactphp/ Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 When you are sending the email you should have it send you the email address that was filled out. so in the $from field it should be there email address. Quote Link to comment https://forums.phpfreaks.com/topic/137665-small-problem-with-contactphp/#findComment-721398 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.