I’m trying to make a formmail for a couple of days now and I can’t get the variables from to pass from Flash to php. The php is found and called correctly, because the mail is sent, but the message isn’t there.
In flash:
var scriptLoader:URLLoader = new URLLoader();
var scriptRequest:URLRequest = new URLRequest("skicka.php");
var skickaDetta:URLVariables = new URLVariables();
skickaDetta.result = "This is my message!";
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = skickaDetta;
scriptLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
scriptLoader.load(scriptRequest);
scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);
and the php:
<?php
$message= $_POST['result'];
$to = 'my.name@gmail.com';
$headers = "From: Matteva
" . "Reply-To: $to
" . "X-Mailer: PHP/" . phpversion();
$subject='Matteva-result';
$ok = mail($to, $subject, $message, $headers);
if($ok) { echo "&server_mes=ok&"; }
else { echo "&server_mes=fail&"; }
?>
I have tried having TEXT instead of VARIABLES as URLLoaderDataFormat (suggested in various discussions).
Any ideas why the php doesn’t recieve the message?