View Full Version : send variable to php

02-11-2007, 11:22 AM
I whant to send variable to php. I am new in php. So I have simple stupid question. Can I save variable in php file or I need to save it in .txt file as string. I don`t whant to save it on database.
I ask like this becouse tutorials I read has // Printing out the variables. from php ( but I whant to save) or
or save in text file like this
//Open a file in write mode
$fp = fopen("myText1.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok&";
else echo "writing=Error&"

but this code don`t work, error in line / fclose($fp); /

I know how to load variable to Flash but there is so few tutorials about send. and each of them are different.
In flash I whant to send a variable from _parent movie and then load variable in _root movie
I am trying to learn using flash and php without xml.

02-13-2007, 07:34 PM
//Open a file in write mode
$fp = fopen("myText1.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok&";
else echo "writing=Error&"
fclose($fp);I'm not the most adept at PHP, but I think it's supposed to look like this://Open a file in write mode
$fp = fopen("myText1.txt", "w");
if(fwrite($fp, $toSave)) {echo "writing=Ok&";}
else {echo "writing=Error&"}
fclose($fp);You need the curly braces. Hope that helps!

02-19-2007, 01:10 PM
Thenk`s for help. Now looks like something works.
php code open a new windows with:

But I expect to see a status.text = "Submited data was saved" in flash.

btn.onPress = function(){
SData.Title = Title.text
SData.send("save.php", SData, "POST")
SData = new LoadVars()
SData.onLoad = function(){
if(this.writing=="Ok") {
status.text = "Submited data was saved"
} else(status.text = "Error in saving submitted data")

status.text area is empty. and also a text file myText1.txt is empty
In the same flash file function should load saved text, but it dosnt, :

poga.onPress = function () {
myData = new LoadVars();
myData.onLoad = function() {
Title.text = this.Title1;

02-22-2007, 04:48 AM
instead of send use sendandload