View Full Version : Resolved mailing "$var" in $var =

08-10-2009, 04:29 PM
I am having a ton of trouble trying to mail the data that was entered into a form using $variables inside another $variable's quotes. It will mail the typed text but will not display the variable in the mail message that it received. Here is the code, all the other codes are fine but this one php page....

$to = "pantheon8@maximized.org";
$subject = "Error Report";
$email = "error_report" ;
$message = "From: $message1
Type of Issue: $message2
Message: $message3 \n";
$message1 = $_REQUEST['email'];
$message2 = $_REQUEST['type'];
$message3 = $_REQUEST['message'];
$headers = "From: $message1";
$sent = mail($to, $subject, $message, $headers) ;
{print "Your mail was sent successfully"; }
{print "We encountered an error sending your mail"; }

Please Help :confused:


08-10-2009, 04:31 PM
Quite obvious, the variables do not exist yet. You are defining $message1, $message2, etc, after including them in the previous string.

08-10-2009, 04:35 PM
omg... I feel so dumb...

atleast now i know! Its kinda like the order the <tr> and <td> have to be in a table...

Thanks sooo much!