# Send variable from flash to php

**URL:** <https://forum.kirupa.com/t/send-variable-from-flash-to-php/285997>\
**Category:** programming\
**Created:** [April 8, 2009, 4:19pm UTC](https://forum.kirupa.com/t/send-variable-from-flash-to-php/285997 "2009-04-08T16:19:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![XJETRy](https://avatars.discourse-cdn.com/v4/letter/x/9d8465/32.png) [@XJETRy](https://forum.kirupa.com/u/XJETRy)\
**Post date:** [April 8, 2009, 4:19pm UTC](https://forum.kirupa.com/t/send-variable-from-flash-to-php/285997/1 "2009-04-08T16:19:54Z")

</div>

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:

```auto
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:

```auto

$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();

```
