FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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!
Related topics
[tutor] How to protect images without htaccess using PHP
Mail with PHP (Simple Tutorial)
Using PHP
Includ Images using PHP.
How to start using PHP? Help!
Website Designing using PHP
how can i setup a page break for printer on html using php ?
Reading word documents using PHP?
I am trying to build a contact form using php and flash
Communicating between web pages
Using PHP's built in mail() to modify the from attribute.
Unable sending mail - verification error
Hot to change "Reset Ownership" using php?
Email Using PHP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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