# Send Variables In and Out PHP and Flash

**URL:** <https://forum.kirupa.com/t/send-variables-in-and-out-php-and-flash/198356>\
**Category:** programming\
**Created:** [August 24, 2006, 11:49am UTC](https://forum.kirupa.com/t/send-variables-in-and-out-php-and-flash/198356 "2006-08-24T11:49:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shin\_ares](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@shin\_ares](https://forum.kirupa.com/u/shin_ares)\
**Post date:** [August 24, 2006, 11:49am UTC](https://forum.kirupa.com/t/send-variables-in-and-out-php-and-flash/198356/1 "2006-08-24T11:49:18Z")

</div>

Hi Guys,

Im a newbie here. I got a problem on how to send variable in and out within PHP and Flash. I tried to follow the tutorial posted in this website but it doesnt work (the tutorial used loadvarnum).

What I have done here is :

- Flash page (called : tessend.html) send a variable (called : name) to php file (called : sendtoflash.php)
- I put the code below in the tessend.html (mc\_button\_submit\_vars is a button):

mc\_button\_submit\_vars.onPress = function ()  
{  
getURL (“sendtoflash.php”, “\_self”, “POST”);  
};

- In sendtoflash.php, I put :  
\<?  
$dataForTxtbox\_1 = “Tes”;  
print("&textbData1=$dataForTxtbox\_1");  
echo “\<script\>”;  
echo “location = ‘mydata.html’”;  
echo “\</script\>”;  
?\>

- PHP file then calls the flash file : mydata.html…the code inside mydata.html is

myData = new LoadVars();  
myData.onLoad = function(){  
placeTheDataIntoTheRightPlace();//call the function  
};  
myData.load(“[http://localhost/sendtoflash.php](http://localhost/sendtoflash.php)”);  
placeTheDataIntoTheRightPlace = function(){  
txtBox1.text = myData.textbData1;  
};

It does work well. But if I change the sendtoflash.php file into :  
\<?  
$dataForTxtbox\_1 = $\_POST[‘name’];  
print("&textbData1=$dataForTxtbox\_1");  
echo “\<script\>”;  
echo “location = ‘mydata.html’”;  
echo “\</script\>”;  
?\>

this doesnt work…

Is there anybody can help me? I posted this question in other forum but couldnt get a correct solution…
