# AS3 and php vars

**URL:** <https://forum.kirupa.com/t/as3-and-php-vars/263722>\
**Category:** flash\
**Created:** [June 18, 2008, 4:56pm UTC](https://forum.kirupa.com/t/as3-and-php-vars/263722 "2008-06-18T16:56:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![billaraw](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@billaraw](https://forum.kirupa.com/u/billaraw)\
**Post date:** [June 18, 2008, 4:56pm UTC](https://forum.kirupa.com/t/as3-and-php-vars/263722/1 "2008-06-18T16:56:19Z")

</div>

Hi there!

when I load vars from my php file the spotsNum var that is loaded is “.$i” instead of 2.

The php file is  
\<?php  
$i = 2;  
echo “&spotsNum=”.$i."&successMessage=ok&end=end";  
?\>

And at the flash file  
function submitToPHP()  
{  
var variables:URLVariables=new URLVariables;  
var request:URLRequest=new URLRequest;  
request.url=“sendvars2.php”;  
request.method=URLRequestMethod.POST;  
request.data=variables;

```
		var loader:URLLoader=new URLLoader(request);
		loader.dataFormat=URLLoaderDataFormat.VARIABLES;
		loader.addEventListener(Event.COMPLETE,completeHandler);
		try
		{
			loader.load(request);
			trace("sending");
		}
		catch (error:Error)
		{
			trace(error.message);
			trace("unable");
		}
	}
	function completeHandler(event:Event):void
	{
		trace(event.target.data.spotsNum);
	}

```

Can anybody help?  
Thanks

---

<div class="post-metadata">

**Author:** ![billaraw](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@billaraw](https://forum.kirupa.com/u/billaraw)\
**Post date:** [June 23, 2008, 10:05am UTC](https://forum.kirupa.com/t/as3-and-php-vars/263722/2 "2008-06-23T10:05:32Z")

</div>

just wondering if anybody found a solution to this problem yet…
