Skip to main content
Known Participant
February 16, 2010
Answered

Send mail with PHP, missing input text?

  • February 16, 2010
  • 1 reply
  • 1416 views

Please help, this can't be difficult to solve. I've created a simple Flash contact form that uses PHP. It functions, but the results in the delivered email do not include the text from the inputs fields in Flash. Also, it does not return a "From" or "Reply-to" value. (This is from a simple tutorial followed exactly, except with 3 added fields. It uses the "LoadVars" method in Actionscript.)

Here is the Actionscript code:

stop();

var senderLoad:LoadVars = new LoadVars();

var receiveLoad:LoadVars = new LoadVars();

     sender.onRelease = function() {

     senderLoad.theName = theName.text;

     senderLoad.theEmail = theEmail.text;

     senderLoad.thePhone = thePhone.text;

     senderLoad.theBuilddate = theBuilddate.text;

     senderLoad.theLot = theLot.text;

     senderLoad.theMessage = theMessage.text;

     senderLoad.sendAndLoad("http://betaclient2.ommvc.com/send.php",receiveLoad);

}

receiveLoad.onLoad = function() {

     if(this.sentOk) {

     _root.gotoAndStop("success");

     }

     else {

     _root.gotoAndStop("failed");

     }

}

Here is the PHP page code:

<?PHP

$to = "dan.ommvc@comcast.net";

$subject = "Custom Home Inquiry";

$message = "Name: " . $theName;

$message .= "\nEmail: " . $theEmail;

$message .= "\nPhone: " . $thePhone;

$message .= "\nBuilddate: " . $theBuilddate;

$message .= "\nLot: " . $theLot;

$message .= "\n\nMessage: " . $theMessage;

$headers = "From: $theEmail";

$headers .= "\nReply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>

(Using Dreamweaver CS4, Flash CS4)

This topic has been closed for replies.
Correct answer kglad

you're welcome.  please mark this thread as answered, if you can.

p.s.  you need to use \r\n or something similar before or after your from and reply-to statements:

1 reply

kglad
Community Expert
Community Expert
February 16, 2010

use:


stop();

var senderLoad:LoadVars = new LoadVars();

var receiveLoad:LoadVars = new LoadVars();

receiveLoad.onLoad = function() {

     if(this.sentOk) {

     _root.gotoAndStop("success");

     }

     else {

     _root.gotoAndStop("failed");

     }

}

     sender.onRelease = function() {

     senderLoad.theName = theName.text;

     senderLoad.theEmail = theEmail.text;

     senderLoad.thePhone = thePhone.text;

     senderLoad.theBuilddate = theBuilddate.text;

     senderLoad.theLot = theLot.text;

     senderLoad.theMessage = theMessage.text;

     senderLoad.sendAndLoad("http://betaclient2.ommvc.com/send.php",receiveLoad,"POST");

}


Here is the PHP page code:

<?PHP

$to = "dan.ommvc@comcast.net";

$subject = "Custom Home Inquiry";

$message = "Name: " . $_POST["theName"];

$message .= "\nEmail: " . $_POST{"theEmail"];  // etc

$message .= "\nPhone: " . $thePhone;

$message .= "\nBuilddate: " . $theBuilddate;

$message .= "\nLot: " . $theLot;

$message .= "\n\nMessage: " . $theMessage;

$headers = "From: $theEmail";

$headers .= "\nReply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>

ommvc61Author
Known Participant
February 16, 2010

This might be it, as I've been getting "POST" feedback.

Question on your "PHP" code suggestion: Are you using "[ ]" or

"{ }" ? It looks like you meant the former, but one is a "{". Please

advise...

Thanks