I am trying to send two String variables to php and from php back to Flash where i am trying to display them in TextField. The problem is that i keep geting this error:
Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
Here is my AS3 code:
var request:URLRequest = new URLRequest ("http://localhost/addUser.php");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.firstName = "FirstName";
variables.lastName = "LastName";
request.data = variables;
var loader:URLLoader = new URLLoader (request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
public function onComplete (event:Event):void{
statusTxt1.text = event.target.data;
}
And my addUser.php code:
<?php
$fname = $_POST['firstName'];
$lname = $_POST['lastName'];
echo $fname;
?>
Can someone please help me on this?
thanks in advance,
cheers