Jump to content

[SOLVED] Advanced Email form in php need help!


TRemmie

Recommended Posts

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 = '[email protected]';
//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?

 

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. */
?>

 

 

Got it! thanks  ;D

 

Final code running something along these lines:

 

<?php

$to = "[email protected]";
$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");

?>

   

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.