hack4lk Posted June 24, 2006 Share Posted June 24, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12819-phpflashsendandload-please-help/ Share on other sites More sharing options...
yonta Posted June 24, 2006 Share Posted June 24, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12819-phpflashsendandload-please-help/#findComment-49184 Share on other sites More sharing options...
hack4lk Posted June 25, 2006 Author Share Posted June 25, 2006 Works great but I had to change the send string to: objSend.sendAndLoad("whatever.php?nocache=" + Math.random(), objSend, "POST"); Quote Link to comment https://forums.phpfreaks.com/topic/12819-phpflashsendandload-please-help/#findComment-49223 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.