I found a good tutorial explaining how to save data from a Flash form into a text file. But something is wrong because it isn’t working on my server (which has PHP support). Here is the actionscript:
[LEFT]
[LEFT]submit.onPress = function(){
if(Title.text!="" && Comments.text !=""){
myData.Title = Title.text
myData.Comments = Comments.text
myData.sendAndLoad("save.php", myData, "POST")
}
}
myData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="Ok") {
gotoAndStop(2)
status.text = "Submited data was saved"
}
else status.text = "Error in saving submitted data"
}
stop()[/LEFT]
And here is the PHP code:
[COLOR=#000000][COLOR=#0000bb]
<?php
$title = $_POST['Title'];
$comments = $_POST['Comments'];
$toSave = "Title=".$title."&Comments=".$comments.;
$fp = fopen("news.txt", "w");
if(fwrite($fp, $toSave)) echo "writing=Ok";
else echo "writing=Error";
fclose($fp);
?>
Is there something wrong in these scripts? I was also reading about chmod permissions on another site, would I have to change these for the file to work? I pretty confused about what’s wrong. My Flash file is also attached, I’ll appreciate any help.[/COLOR][/COLOR][/LEFT]