I'm back again. Forgive my "noob" questions, but I'm having trouble with the email headers. Is there any way to have the "From" of an email replaced with the text of a form element? When the form submits without any $headers, I get an email from "myaccount(a)myserver.hostingcompany.com". When I add...
PHP Code:
$headers = "From: $name_field";
...the email header is blank. When I use...
PHP Code:
$headers = "From: 'name'";
...I get 'name'(a)myserver.hostingcompany.com. Is there any way to get the full text and just the text to appear? Here is the full code, if it helps.
PHP Code:
<?php if(isset($_POST['submit'])) {
$to = "fake@email"; $subject = "Attendance Correction Form"; $headers = "From: $name_field"; $forward = 1; $name_field = $_POST['name']; $department = $_POST['department']; $supervisor = $_POST['supervisor']; $date_correction = $_POST['datecorrection']; $time_in = $_POST['timein']; $lunch_out = $_POST['lunchout']; $lunch_in = $_POST['lunchin']; $time_out = $_POST['timeout']; $body = "From: $name_field\n Department: $department\n Supervisor: $supervisor\n Date Needing Correction: $date_correction\n Time In: $time_in\n Lunch Out: $lunch_out\n Lunch In: $lunch_in\n Time Out: $time_out"; echo "Thank you. Your form has been submitted."; mail($to, $subject, $body, $headers);
} else {
echo "ERROR!";
} ?>
Thanks for the help!
Last edited by werm82; 09-30-2008 at 06:38 PM..
|