# Ok, getting =\>desperate...\<= Plz I need simple HELP about AS & PHP interaction

**URL:** <https://forum.kirupa.com/t/ok-getting-desperate-plz-i-need-simple-help-about-as-php-interaction/190882>\
**Category:** Uncategorized\
**Created:** [June 15, 2006, 11:36am UTC](https://forum.kirupa.com/t/ok-getting-desperate-plz-i-need-simple-help-about-as-php-interaction/190882 "2006-06-15T11:36:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0ddude](https://avatars.discourse-cdn.com/v4/letter/g/74df32/32.png) [@g0ddude](https://forum.kirupa.com/u/g0ddude)\
**Post date:** [June 15, 2006, 11:36am UTC](https://forum.kirupa.com/t/ok-getting-desperate-plz-i-need-simple-help-about-as-php-interaction/190882/1 "2006-06-15T11:36:37Z")

</div>

Owkay,

I saw thousands of sites about PHP & Flash, but nearly all are using MySQL.  
Don’t wanna talk about MySQL, but even the SIMPLEST PHP script (written by myself :puzzled:) won’t work…

This is the main problem: Getting variables from PHP =\> Flash Actionscript.  
The other way 'round (Flash AS =\> PHP) works with “$\_POST[‘variable’]”.

Let’s say i want to send 2 numeric variables to a PHP-file, the PHP-file makes the sum and returns the result to Flash AS…  
Thought this would be piece of cake (and most programmers sure will say it is ;)) but for me, it turned out not to be that easy…

* * *

FLASH CODE I’LL USE:

my\_lv = new LoadVars();  
my\_lv.var1 = 1; //1 for simplifiying things, u could use \_root.myText.text for instance…  
my\_lv.var2 = 2; //Same as above…  
my\_lv.sendAndLoad(“[www.myserver.com/thescript.php](http://www.myserver.com/thescript.php)”, this, “POST”);  
\_root.myResultTextArea.text=my\_lv.result;

* * *

PHP CODE: (thescript.php in my root directory on [myserver.com](http://myserver.com))

\<? php  
$v1=$\_POST[‘var1’];  
$v2=$\_POST[‘var2’];  
$sum=$v1+$v2;  
echo “&result=$sum”;  
?\>

* * *

As i said, i know the $\_POST[…] thing works, so $v1 and $v2 are resp. 1 & 2. My pain in the \*\*\* is getting the result back into flash…  
I’ve searched & edited already lots of things:

- change | echo “&result=$sum”; | to | echo “result=$sum”; | or | echo “&result=”.$sum; | or about anything 😃
- change CHMOD to 777 (all rwx)
- tried some other actionscript functions & both LoadVars - LoadVariables objects…

So is there anyone who can help me or explain me for this once & only how to use this properly (perhaps with example 😏 )

Thanks…!
