# How should i correctly pass variables to my PHP?

**URL:** <https://forum.kirupa.com/t/how-should-i-correctly-pass-variables-to-my-php/265722>\
**Category:** Uncategorized\
**Created:** [July 11, 2008, 5:09pm UTC](https://forum.kirupa.com/t/how-should-i-correctly-pass-variables-to-my-php/265722 "2008-07-11T17:09:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarmanje](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jarmanje](https://forum.kirupa.com/u/jarmanje)\
**Post date:** [July 11, 2008, 5:09pm UTC](https://forum.kirupa.com/t/how-should-i-correctly-pass-variables-to-my-php/265722/1 "2008-07-11T17:09:18Z")

</div>

Hi there, I have some code now which gets info from my DB using php:

```auto
var myLoader:URLLoader = new URLLoader()
	myLoader.dataFormat = URLLoaderDataFormat.VARIABLES
	myLoader.load(new URLRequest("Data3.php"))
	
	myLoader.addEventListener(Event.COMPLETE, onDataLoad)
	myLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError)
	myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError)
	myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus)   
			
	function onIOError(evt:IOErrorEvent){
		trace("IOError: "+evt.text)
	}
	function onHTTPStatus(evt:HTTPStatusEvent){
		//trace("HTTPStatus: "+evt.status)
	}
	function onSecurityError(evt:SecurityErrorEvent){
		trace("SecurityError: "+evt.text)
	}
		
	function onDataLoad(evt:Event) {

//etc etc etc

```

How can i pass 2 variables to my php file?

i tried like the below, but to no avail

```
var theVariables:URLVariables = new URLVariables();
theVariables.varEmail = MovieClip(parent).globalUserAccount;
theVariables.varCurrency = MovieClip(root).globalCurrency;
```

---

<div class="post-metadata">

**Author:** ![Thinker2501](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Thinker2501](https://forum.kirupa.com/u/Thinker2501)\
**Post date:** [July 14, 2008, 7:43pm UTC](https://forum.kirupa.com/t/how-should-i-correctly-pass-variables-to-my-php/265722/2 "2008-07-14T19:43:30Z")

</div>

You could just use the GET http method, then use $\_GET in your php to access the variables:

URL

```auto

yoururl.com?variable1=value&variable2=value

```

PHP

```auto

<?php
  myVar = $_GET[variable1];
?>

```
