PDA

View Full Version : Simple PHP to AS prob.



HL_Novice
December 4th, 2003, 10:56 PM
hello, i am sending data from flash to php to my database with no prob. But i cant get my the php to send variable, called "checklog" back to my flash file.

this is the code i used on my submit button in flash

on(press){
_root.checklog=0;
loadVariablesNum ("http://www.site.com/processForm.php",0,"post");
}

this is the code in my frame 1

stop();
this.onEnterFrame = function () {
trace(checklog);
if(_root.checklog == 1){
_root.gotoAndStop(2);
}
}

this is the last two line of my php file.


<?
.....
$valueCheck=1;
print "&checklog=".$valueCheck;
?>



Now my trace(checklog) in my main Frame return 1 but its packed with spaces and i dont move to frame 2. Can someone help me or am i doomed to suck at this.
:ne:

-woj-

hamza84
December 5th, 2003, 12:36 AM
I would suggest that you use sendAndLoad() function. I think its more easier. Do you know how to use it or do you want an example?

HL_Novice
December 5th, 2003, 12:37 AM
thanks, i would like a exemple please!

hamza84
December 5th, 2003, 12:41 AM
in flash, use this code:

dataReceive = new LoadVars();
dataSend = new LoadVars();


then on the button use:

on(press){
_root.checklog=0;
dataSend.sendAndLoad("http://www.site.com/processForm.php",0,"post");
}


If u want to access the variable received from PHP, use:

checklog = dataReceive.checklog;


hope it works

HL_Novice
December 5th, 2003, 12:55 AM
well now the data aint registrating in my database :(
lol...

hamza84
December 5th, 2003, 01:13 AM
whats ur php code?

λ
December 5th, 2003, 12:02 PM
Originally posted by hamza84
in flash, use this code:

dataReceive = new LoadVars();
dataSend = new LoadVars();


then on the button use:

on(press){
_root.checklog=0;
dataSend.sendAndLoad("http://www.site.com/processForm.php",0,"post");
}


If u want to access the variable received from PHP, use:

checklog = dataReceive.checklog;


hope it works

You should use:



dataSend.sendAndLoad("http://www.site.com/processForm.php",dataRecieve,"post");


my_lv.sendAndLoad(url, targetObject[, method]);
;)

hamza84
December 5th, 2003, 12:35 PM
OH! I didn't notice that. Nice lookin out nj.