# Problem sending data to php

**URL:** <https://forum.kirupa.com/t/problem-sending-data-to-php/318866>\
**Category:** flash\
**Created:** [February 2, 2011, 4:07am UTC](https://forum.kirupa.com/t/problem-sending-data-to-php/318866 "2011-02-02T04:07:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamminBill](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@JamminBill](https://forum.kirupa.com/u/JamminBill)\
**Post date:** [February 2, 2011, 4:07am UTC](https://forum.kirupa.com/t/problem-sending-data-to-php/318866/1 "2011-02-02T04:07:53Z")

</div>

I have two text fields. One is named txtFoo and the other is txtBar. They have numbers in them. When I click the btnSubmit I want the txtFoo.text and txtBar.text to be sent to a php file. Below is my code:

```auto
var variables:URLVariables=new URLVariables;
var varSend:URLRequest=new URLRequest("myURL.cgi");
varSend.method=URLRequestMethod.POST;
varSend.data=variables;
var varLoader:URLLoader=new URLLoader;
varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE,completeHandler);

function completeHandler(evt:Event):void{
    varLoader.load(varSend);
}

function submit(evt:MouseEvent):void{
    variables.foo=txtFoo.text;
    variables.bar=txtBar.text;
    varLoader.load(varSend);
}
btnSubmit.addEventListener(MouseEvent.CLICK,submit);

```

I’m getting the error message below:

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.  
at Error$/throwError()  
at [flash.net](http://flash.net)::URLVariables/decode()  
at [flash.net](http://flash.net)::URLVariables()  
at [flash.net](http://flash.net)::URLLoader/onComplete()
