FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Sending mail with flash using PHP

 


Reign
Hi, don't know if this is the right place but I'll just give it a try...

I want to send an email with flash trough php, It sends an email, but doesn't include the message, name, email and so on...

PHP Code:
Code:
<?PHP

$to = "user@gmail.com";
$subject = "Flash Contact Form Submission";
$message = "Name: " . $theName;
$message .= "\nEmail: " . $theEmail;
$message .= "\n\nMessage: " . $theMessage;
$headers = "From: $theEmail";
$headers .= "\nReply-To: $theEmail";

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

echo "sentOk=" . $sentOk;

?>


Actionscript:
Code:
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();

sender.onRelease = function() {
   senderLoad.theName = theName.text;
   senderLoad.theEmail = theEmail.text;
   senderLoad.theMessage = theMessage.text;
   senderLoad.sendAndLoad("http://flash.reignofterror.be/send.php",receiveLoad);
}

receiveLoad.onLoad = function() {
   if(this.sentOk) {
      theMessage.text = "OK"
   }
   else {
      theMessage.text = "NOT ok"
   }
}


the names of my textfields in flash are identical with the vars in the php...

It sends this to my email:
Quote:

Name:
Email:

Message:


What am I doing wrong??
Sappho
I think u r missing this at the beginning of the PHP script since Flash sends variables through POST method:

Code:
$theName = $_POST["theName"];
$theEmail = $_POST["theEmail"];
$theMessage = $_POST["theMessage"];


and about the $sentOk u forgot that Flash needs variables to be sent to him in &variable=... format so u forgot the & Its like this:

Code:
echo "&sentOk=";
echo $sentOk;


I always parse it in more lines couse of better readability Wink
Reign
dude, thanx alot! the text comes in the email now

but the header don't... I tried the same method with post but that didn't work

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


So what about that?


EDIT:

Nevermind forgot the [ ]
Again, thanx alot!
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.