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

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”, this, “POST”);
_root.myResultTextArea.text=my_lv.result;


PHP CODE: (thescript.php in my root directory on 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 :smiley:
  • 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 :smirk: )

Thanks…!