# Retrieving variables from PHP to FLASH

**URL:** https://forum.kirupa.com/t/retrieving-variables-from-php-to-flash/315411
**Category:** flash
**Created:** [October 25, 2010, 3:08pm UTC](https://forum.kirupa.com/t/retrieving-variables-from-php-to-flash/315411 "2010-10-25T15:08:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Joogra](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Joogra](https://forum.kirupa.com/u/Joogra)
#### Post date: [October 25, 2010, 3:08pm UTC](https://forum.kirupa.com/t/retrieving-variables-from-php-to-flash/315411/1 "2010-10-25T15:08:19Z")

</div>

Hey!

This all is for a Highscoretable in flash.

Ive tried to find a thread for hours that would be of any help for me, but without success, so I thought of posting my own thread here.

The deal is, I’m trying to set up a function to retrieve variables from a PHP echo.

**The echo reads like this:**

```auto
&user1=babby&score1=19&user2=bobby&score2=18&user3=milson&score3=17&user4=josh&score4=16&user5=sam&score5=15&user6=donald&score6=14&user7=alex&score7=13&user8=mike&score8=12&user9=bob&score9=11&user10=joe&score10=10

```

**The actionscript:**

```auto
var url:String = "http://b-files.netau.net/getscores.php";
var reqURL:URLRequest = new URLRequest(url);
var loader:URLLoader = new URLLoader(reqURL);
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;

function handleComplete( event:Event):void
{
	var loader:URLLoader = URLLoader(event.target);

	trace(loader.data["user1"]);
	trace(loader.data["score1"]);
	trace("-------------------");
	trace(loader.data["user2"]);
	trace(loader.data["score2"]);
	trace("-------------------");
}

```

\*\*The output i get is: \*\*

```auto
babby
19user2=bobby
-------------------
undefined
18user3=milson
-------------------

```

Now I wonder why the 2nd userame line says “undefined” and the 1st score line says “19user2=bobby” when i would like the 2nd username to say “bobby” and the 1st score to simply say “19”.

I can’t seem to get this right and I would be very glad if someone here would know what I am doing wrong !

// Joel

ps. sorry for the code wrapping, as my first post i didnt know how to wrap AS3 code correctly.
