The following two examples are quite simple and for the life of me I can’t figure out what is wrong. I must have spent all of two days unsuccessfully searching the internet for some insight.
Thanxs in Advance: Lastradius
EXAMPLE 1:
Can anybody tell me why the following code reads $fname $lName and $age in the Output Panel of Flash when I’m expecting to see Lazlo Bernini and 36 returned from the php script.
THE SWF FILE
var rData:LoadVars = new LoadVars();
rData.load(“external.php”);
rData.onLoad = function(){
trace(this.fName);
trace(this.lName);
trace(this.age);
};
THE PHP FILE:
<?php
$fName = “Lazlo”;
$lName = “Bernini”;
$age = 36;
echo ("&fName=$fName&lName=$lName&age=$age&");
?>
EXAMPLE 2:
Pretty simple, right, the flashCount is sent to the PHP script, iterated, and returned with a value of 2. Only problem is my Output panel simply reads ‘$phpCount’. I don’t have a clue what’s wrong!
SWF FILE
var rData:LoadVars = new LoadVars();
rData.flashCount = 1;
rData.onLoad = function() {
var newFlashCount = rData.theCount;
trace(newFlashCount);
};
rData.sendAndLoad(“external.php”, rData, “POST”);
PHP FILE:
<?php
$phpCount = $_POST[‘flashCount’];
$phpCount++;
echo “&theCount=$phpCount&”;
?>