I got the following super simple code on my Flex app:
private function OnButtonClick():void
{
var request:URLRequest = new URLRequest("http://juaneco.webatu.com/index.php");
request.contentType = "text/xml";
request.data = "hello";
request.method = URLRequestMethod.POST; // POST Right here!
var loader:URLLoader = new URLLoader(request);
loader.load(request);
}
and this is my php code (after conecting to database and all that):
foreach ($_POST as $varname => $varvalue) {
$query = "INSERT INTO `a4510541_data`.`prueba` (".
"`id` ,".
"`varname` ,".
"`varvalue`".
")".
"VALUES (".
"NULL , 'POST: ".$varname."', '".$varvalue."'". // POST Right here!
");";
mysql_query($query);
}
The thing is that when I replace POST for GET on both lines where the "POST Right here!" comment is, everything works fine, my database get fed by my Flex app, but nothing at all happens when I use POST instead. Am I missing something?
Sorry I meant to put the "POST Right here!" comment on the php line where "foreach ($_POST as $varname => $varvalue) {" is and not on that other one, so I would change that $_POST for $_GET whenever I also use GET on the Flex code.
If there seem to be nothing wrong with my code please let me know, I'm new on Flex at my problem might be on the server side.