# From php to flash

**URL:** <https://forum.kirupa.com/t/from-php-to-flash/283004>\
**Category:** Uncategorized\
**Created:** [March 1, 2009, 8:15am UTC](https://forum.kirupa.com/t/from-php-to-flash/283004 "2009-03-01T08:15:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saxx](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@saxx](https://forum.kirupa.com/u/saxx)\
**Post date:** [March 1, 2009, 8:15am UTC](https://forum.kirupa.com/t/from-php-to-flash/283004/1 "2009-03-01T08:15:46Z")

</div>

For example i have this php code to check if the username is already in the mysql database

```php
if(usernameTaken($usernameFromFlash )){

// how to pass an error message to flash?

   }
   else{
addNewUser($usernameFromFlash, $passwordFromFlash);
}

```

as you can see if the statement is true, it does nothing. I can’t for the life of me figure out how to pass an error message to flash.

If it helps, here’s my as3 code.

```auto
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
stop();

var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("register.php");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

bt_sub.buttonMode = true;
bt_sub.addEventListener(MouseEvent.CLICK, ValidateAndSend);

function ValidateAndSend(event:MouseEvent):void

{
	
	
	 variables.user = user_txt.text;
	 variables.pass = pass_txt.text;

   		varLoader.load(varSend);
	
}

```
