# Sending variables from Flash to php and back to Flash

**URL:** <https://forum.kirupa.com/t/sending-variables-from-flash-to-php-and-back-to-flash/238805>\
**Category:** flash\
**Created:** [September 15, 2007, 1:10pm UTC](https://forum.kirupa.com/t/sending-variables-from-flash-to-php-and-back-to-flash/238805 "2007-09-15T13:10:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![psych](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/psych/32/2839_2.png) [@psych](https://forum.kirupa.com/u/psych)\
**Post date:** [September 15, 2007, 1:10pm UTC](https://forum.kirupa.com/t/sending-variables-from-flash-to-php-and-back-to-flash/238805/1 "2007-09-15T13:10:24Z")

</div>

I am trying to send two String variables to php and from php back to Flash where i am trying to display them in TextField. The problem is that i keep geting this error:

```auto
Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

```

Here is my AS3 code:

```auto
var request:URLRequest = new URLRequest ("http://localhost/addUser.php");
request.method = URLRequestMethod.POST;
                
var variables:URLVariables = new URLVariables();
                
variables.firstName = "FirstName";
variables.lastName = "LastName";            
request.data = variables;
                
var loader:URLLoader = new URLLoader (request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
                
        
public function onComplete (event:Event):void{
statusTxt1.text = event.target.data;
}

```

And my addUser.php code:

```php
<?php

$fname = $_POST['firstName'];
$lname = $_POST['lastName'];

echo $fname;

?> 

```

Can someone please help me on this?

thanks in advance,  
cheers
