# This doesn't work.. and it should

**URL:** <https://forum.kirupa.com/t/this-doesnt-work-and-it-should/281089>\
**Category:** Uncategorized\
**Created:** [February 4, 2009, 8:00pm UTC](https://forum.kirupa.com/t/this-doesnt-work-and-it-should/281089 "2009-02-04T20:00:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michdd](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@michdd](https://forum.kirupa.com/u/michdd)\
**Post date:** [February 4, 2009, 8:00pm UTC](https://forum.kirupa.com/t/this-doesnt-work-and-it-should/281089/1 "2009-02-04T20:00:53Z")

</div>

I set up something using almost the same exact code as something else I got to establish communication between the flash file and a php file. But for some reason it’s not working now. But the other one works, and the code is pretty much the same…

AS3:

```auto

submit_btn.addEventListener(MouseEvent.CLICK, submit);

function submit(event:Event):void {
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("http://mysite/config_flash.php");

varSend.method = URLRequestMethod.POST;
varSend.data = variables;
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

   		variables.sendRequest = "parse";	
		// Send the data to the php file
   		varLoader.load(varSend);

// When the data comes back from PHP we display it here		
function completeHandler(event:Event):void{
	
	var phpVar1 = event.target.data.win;
	
	if(phpVar1 == "1"){
		message_txt.text = "Your submission has been successfully added!";
	} else { 
	message_txt.text = "Your submission failed";
	trace(phpVar1);
	}
	

}	
}

```

PHP:

```auto

<?php

if ($_POST['sendRequest'] == "parse") {

print "win=1";

}
?>

```

Yet every time I try it outputs the error message in the text field and the trace returns a undefined variable.
