I'm working on a flash content on my website that contains an input box and a submit button. The user should put an answer of a question in the input box and when he clicks on submit, the answer should be sent to an email address. The problem is, when a user enters an answer, I receive an email that contains :
array (
)
. Here are my codes:
AS3 Code:
var myData:URLVariables = new URLVariables();
myData.answer = answer.text;
var myRequest:URLRequest = new URLRequest("example.php");
myRequest.data = myData;
myRequest.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
The button's code:
myButton.addEventListener(MouseEvent.CLICK, sen) ;
function sen(Event:MouseEvent):void
{
navigateToURL( new URLRequest("example.php"), "_self");
}
The PHP code:
<?php
$text = var_export($_POST, true);
$to = "[email protected]";
$subject="Message from php";
mail($to,$subject,$text,"Content-Type: text/plain; charset=utf-8");
?>
So, what am I doing wrong?