I am trying to send variables from Flash to PHP using loadVars.send(), and it just plain isn’t getting them there. i don’t understand it. I think the problem may be that the line after the loadVars.send(); is gotoAndPlay(3); and I dont think that the loadVars have sent yet. Can someone have a look at both my actionScript and my PHP and see if they can tell me what the problem is?
ActionScript:
on (release) {
logger = new LoadVars();
logger.theQuestion = _root.question.text;
logger.theAnswer = _root.answertext.text;
logger.send("logger.php");
_root.gotoAndStop(3);
}
PHP:
<?PHP
$theQuestion = $_POST['theQuestion'];
$theAnswer = $_POST['theAnswer'];
if($theQuestion && $theAnswer) {
$filename = "theLog.txt";
$fp = fopen( $filename,"r");
$OldData = fread($fp, 80000);
fclose( $fp );
$Input = "$theQuestion<br>
$theAnswer<br><br>
";
$New = "$Input$OldData";
$fp = fopen( $filename,"w");
fwrite($fp, $New, 80000);
fclose( $fp );
}
include "theLog.txt";
?>