TRemmie Posted May 1, 2008 Share Posted May 1, 2008 So I am building a flash -> php email form, and other then the basic name,email,subject,message boxes, I want to do boxes like with address, age, telephone number, etc. I would like the normal stuff obviously, but I would like to display all the detailed information about the person to appear in the message part of the email. I can get the simple <?php //define the receiver of the email $to = 'admin@website.com'; //define the subject of the email $subject = $_REQUEST["Subject"]; //define the message to be sent. Each line should be separated with \n $message = " - need help here - "; //define the headers we want passed. Note that they are separated with \r\n //send the email $mail_sent = @mail( $to, $subject, $message ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?> Is there a way to call variables from multiple forms on the flash to the $message? Quote Link to comment Share on other sites More sharing options...
colombian Posted May 1, 2008 Share Posted May 1, 2008 If I understand your challenge correctly... You can include as many form fields in the $message. <?php $message = "Thank you bla bla email content "; $message .= "Name: ".$name; //the $name is from the form field that the user submitted $name = $_POST['name']; $message .= "Telephone: ".$phone; //ditto /* etc... just attach all the variables to the message. You will need the <br> /t /n for formatting the email depending on how you want to space the content inside. */ ?> Quote Link to comment Share on other sites More sharing options...
TRemmie Posted May 1, 2008 Author Share Posted May 1, 2008 Got it! thanks Final code running something along these lines: <?php $to = "name@domain.com"; $headers = "$_POST["email"] " $subject = "subject of the email goes here" $msg = "$name\n\n"; $msg .= "$address\n\n"; $msg .= "$phonenumber\n\n"; $msg .= "$message\n\n"; mail($to, $subject, $msg, "From: $email\nReply-To: $email\n"); ?> Quote Link to comment 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.