Forum Moderators: coopster
I want to send the contents of a form from Flash via PHP through email. Now I can do this fine when my email message 'body' is made from one variable, but for some reason when I try to gather multiple variables (from multiple fields in the form) and send these as the message body, nothing happens,
any ideas?
oh and heres my script (probably very wrong)
<?php
$sendTo = "enquiries@example.com";
$subject = "Website Quote Enquiry";
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$EcompName = $_POST["compName"];
$EcontName = $_POST["contName"];
$Eemail = $_POST["email"];
$Etel = $_POST["tel"];
$Edetails = $_POST["details"];
$message = $EcompName $EcontName $Eemail $Etel $Edetails;
mail($sendTo, $subject, $message, $headers);
?>
cheers,
[edited by: jatar_k at 5:36 pm (utc) on Aug. 16, 2005]
[edit reason] examplified [/edit]
just one more thing, I want each variable to be on a different line in the email, I've tried this
$message = $EcompName\n . $EcontName\n . $Eemail\n . $Etel\n . $Edetails\n;
with \n and it doesn't seem to work, so will I have to produce line breaks in HTML through PHP and display the email in HTML, to make this work?
$message = $EcompName . "\n" . $EcontName . "\n" . $Eemail . "\n" . $Etel . "\n" . $Edetails. "\n";
I think that would work ... you might have to put in a "\r\n" instead of just "\n" to get a line break, I think it depends on the OS.
You could also through the whole thing into one big string:
$message = "$EcompName \n $EcontName \n $Eemail \n $Etel \n $Edetails \n";
Guess it depends on how readable you want your code to be.
-sned