View Full Version : passing variables between php and flash
jkd77
12-17-2001, 09:03 PM
Specifically, how do I pass a variable from PHP to Flash?
Would it be ?variable=myValue; // ???
I think the PHP file can pretty much read the Flash variables from input textBoxes already, as per a tutorial I saw.
Any help would be lovely.
http://www.actionscripts.org/tutorials/intermediate/loadVariables_script_interaction/index.shtml
jkd77
12-18-2001, 04:01 PM
I followed that tutorial the best I could, but no dice.
I'm attempting to send a credit card verification php script 2 variables: cardType and cardNumber.
Those are the variables assigned to two dynamic input text boxes. After keying in the appropriate card type and number:
I use a button to start the verification process, with actionscript like so:
on (release) {
loadVariablesNum("maxCCverify.php3", 0, "POST");
// check to see if the php loaded the value yet...
if (cardOk != "") {
if (cardOk == "ok") {
gotoAndStop (_currentframe + 1);
} else if (cardOk == "numberProblem") {
part2error.gotoAndStop(3);
} else if (cardOk == "generalProblem") {
part2error.gotoAndStop(4);
}
}
}
In my php file, I have the following:
$cardStatus = "numberProblem";
print &cardOk = $cardStatus;
According to that tutorial, the "print" is an output command, one I assumed flash understood.
The gist is that this still doesn't seem to be working. Is it because this is all occuring within a mc?
This is one of the last things I need to get working on a friend's site, I'm SO close! Please help!
Ricod
12-19-2001, 03:50 PM
Its supposed to be :
print "&cardOk = $cardStatus;"
jkd77
12-19-2001, 04:30 PM
print "&cardOk = $cardStatus;"
or like so:
print "&cardOk = $cardStatus";
???
Ricod
12-19-2001, 04:39 PM
sorry, thats :
print "whatever";
jkd77
12-19-2001, 04:58 PM
am I supposed to put some extra code in the html file that embeds my shockwave file for the php? I've seen other tutorials that do this... something about including the variables to be passed inside the embed tag or something?
Ricod
12-19-2001, 05:14 PM
no, loadVariables oughta work just fine. Did u clear the memory of yer explorer before u tried again ?
jkd77
12-19-2001, 06:03 PM
hmmm, perhaps there's something wrong with my php file.
I'll upload it. If you have a moment, please advise.
Ricod
12-19-2001, 07:09 PM
Did u try something simpeler first ? Just a print statement. If that works, then its in the if statements. I'm not sure here.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.