I feel stupid asking this question, but I've been wrestling with it for hours and I don't know where else to turn.
I have a flash form that is making a POST request to a php script, and then displays the output of the said script. For the sake of simplicity, let's say this is the php script:
echo 'Mail sent to: ' . $_POST['recipientEmail'];
When I submit the form, I see this in Firebug's net tab in the line made by the POST request:
Referer: http://example.com/my.swf
Content-type: text/html
Content-length: 68
[email protected]
All well and good on the surface. The post has been made, it sent the right variable to the script. But when the response comes back, this is what I see in my Flash tracer:
Mail sent to:
In other words, the $_POST['recipientEmail'] has been lost after the request went out of my browser.
What do you think is happening here? Both the script and the swf file are in the same domain, same server.
EDIT: I just tried hitting the same script from an HTML form, and it catches the $_POST header. So it's only not catching it when it's sent by Flash. The post tab in Firebug looks a little different than it is with flash:
recipientEmail [email protected]
submit Submit
Notice each variable is in its own line.
EDIT: Here is the relevant AS3 code that makes the submission:
var _gateway:String = Share.getGateway();
var request:URLRequest;
var variables:URLVariables = new URLVariables();
var loader:URLLoader = new URLLoader();
request = new URLRequest(_gateway);
request.contentType = 'text/html';
request.method = URLRequestMethod.POST;
variables.senderName = senderName.text;
variables.recipientEmail = recipientEmail.text;
variables.senderMessage = senderMessage.text;
request.data = variables;
try {
loader.load(request);
}catch (error:Error) {
Debug.trace("Unable to load requested document.");
}