I am trying to send a single variable from a flash application to a php file. The user input field in flash will send a variable to the php file for purging of the database. The following returns nothing. There is no error. I believe the error is in the php and not the flash.
Here is my actionscript for the flash:
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
// ----------------------------------------------------------------
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("http://www.clevelandbrowns.cc/XML/wsw2_XML.php");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
button.addEventListener(MouseEvent.CLICK, sendStuff);
function sendStuff(evt:MouseEvent):void{
trace(txt.text);
variables.topic = txt.text;
navigateToURL(varSend, '_self');
}
Here is my php:
$select = $_POST['topic'];
$sql = mysql_query("SELECT * FROM wsw WHERE topic='$select'");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
print "<items>
";
while($line = mysql_fetch_assoc($sql)){
print " <item>
";
print " <author>" . $line["author"] . "</author>
";
print " <source>" . $line["source"] . "</source>
";
print " <topic>" . $line["topic"] . "</topic>
";
print " <quote>" . $line["quote"] . "</quote>
";
print " <link>" . $line["link"] . "</link>
";
print " <img>" . $line["img"] . "</img>
";
print " </item>
";
}
print "</items>
";
mysql_close();