PDA

View Full Version : php form $from_header



pucca
May 10th, 2006, 10:17 AM
Hi there
I've got a submit form on a website, but doesn't have an email field. Usually, when I develop a form to send mail, I include the email as the $from_header. Like this :

$header = "From: " . $email;
mail("my@email.com", $subject, $body, $header);


But now, I want the name field to show in the From column.. Like this :


$header = "From: " . $name;
mail("my@email.com", $subject, $body, $header);

but if I do that, it puts on this long "looks like an email address" after the name.

Hope you understand?

Please let me know how I can make only the senders name show in the email.

Thanks!

pucca
May 11th, 2006, 03:23 AM
ok.. heres my code! please help!




$name = $_POST['name'];
$tel = $_POST['tel'];
$address = $_POST['address'];
$company = $_POST['company'];
$venue = $_POST['venue'];

$subject = "My subject";
$body = "A little intro paragrah : " . "\n\n";
$body .= "Name : " . $name . "\n";
$body .= "Telephone Number : " . $tel . "\n";
$body .= "Company : " . $company . "\n";
$body .= "My address: " . $address . "\n";
$body .= "I'll be attending the " . $venue . " venue" . "\n";
//now, here, below, I've put in $name, cause theres no email.. but if I send the mail, the name shows in the From: line, but with "stuff" afterwards
$from_header = "From: " . $name;
$success = mail("how@todothis.com", $subject, $body, $from_header);

If anybody know how, please help! There IS a way, I just cant' find it?

Thanks!