Jump to content

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.