Jump to content

PHP/FLASH/sendAndLoad - PLEASE HELP!!!!


hack4lk

Recommended Posts

Hi everyone....I have spent the last day trying to figure this problem out but cannot find what it is....I cannot send vars to php...but I can receive them in flash as echos from php....I am using sendAndLoad to send the vars to php....here is the code.

[b]::Flash::[/b]
var sendData:LoadVars = new LoadVars();
sendData.myVar1 = "11111";
sendData.myVar2 = "impact";
sendData.sendAndLoad("test2.php", sendData, "POST");

[b]::PHP::[/b]
$myVar1 = $_POST['myVar1'];
$myVar2 = $_POST['myVar2'];
echo $myVar2;


Thanks for any advice in advance.
Link to comment
https://forums.phpfreaks.com/topic/12819-phpflashsendandload-please-help/
Share on other sites

Here's an example (actionscript function):

function loadwhatever(){
var objSend:LoadVars = new LoadVars();

/*Values to be sent (id) */
objSend.id = '1';

/*Send variable to php and load the variables*/
objSend.sendAndLoad(whatever.php+"?nocache=" + Math.random(), objSend, "POST");

/*When the results are loaded into flash - add this*/
objSend.onLoad = function(ok) {

//do something here
}
}

In my experience you should force flash to not cache the results. Otherwise when you're testing you won't see he changes you made to the code.

On the php side everything seems fine.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.