View Full Version : variables to PHP
eggnogg
04-14-2003, 11:44 AM
grrretings! ;)
i got this tutorial to teach me how to send variables to php, but on the "send button" i found the loadVariablesNum !! like, duh!
isn't the loadVariableNum supposed to load variables into flash?!
how can i send variables to php, so that the php can use them to send me an email listing all the variables i declared in the flash movie?
loadVars.send ?
check out the php file pls...dunno if it is 100% accurate..
thx ppl
eggnogg :D
CyanBlue
04-14-2003, 12:02 PM
Howdy...
See the end of this thread (http://www.actionscript.org/forums/showthread.php3?s=&threadid=24836)... I have sample code created right there...
And you look like you should use sendAndLoad() function to do that...testLVs = new LoadVars();
// Define things you want to send to your script...
testLVs.ToName = "Jason";
testLVs.var1 = "Variables to send to PHP script";
testLVs.var2 = "These names shoudl match with";
testLVs.var3 = "your variables in the PHP script";
testLVs.var4 = "so that it will be recognized";
testLVs.var5 = "in the PHP script.";
testLVs.onLoad = function(success)
{
if (success)
{
trace("Data has been sent and loaded successfully...");
trace("I have got " + testLVs.EmailStatus + " from the PHP script.");
}
else
{
trace("You have problem now...");
}
};
testLVs.sendAndLoad("http://www.mydomain.com/myscript.php?uniqueID=" + getTimer(), testLVs, "POST");In your PHP script...Print "_root.EmailStatus=A sua encomenda foi enviada com sucesso!";should bePrint "EmailStatus=A sua encomenda foi enviada com sucesso!";since this will be assigned into the instance of the LoadVars() object...
and you should define each variables that you get from the Flash in the beginning... like this...$nome = $_POST['nome'];You should do some searching before you actually post your question... ;)
PS>> What is the odd of writing three examples of LoadVars() object's load(), send(), and sendAndLoad() functions in one night??? :confused:
eggnogg
04-14-2003, 12:57 PM
heya CyanBlue
err...
testLVs.sendAndLoad("http://www.mydomain.com/myscript.php?uniqueID=" + getTimer(), testLVs, "POST");
what's "?uniqueID= + getTimer(), textLVs" ?
eggnogg
CyanBlue
04-14-2003, 01:01 PM
The base form of this sendAndLoad() function would be...testLVs.sendAndLoad("http://www.mydomain.com/myscript.php", testLVs, "POST");and I have added ?uniqueID=" + getTimer()at the end of the PHP script name for the URL so that Flash will call that PHP script everytime... If you don't have that part, chances are that the PHP file will be loaded from the cache... So, basically that part is there to get away from it... Know what I mean??? ;)
boyzdynasty
04-15-2003, 06:53 PM
Know what I mean??? ;)*raises hand..*
*i know*
*i know*
Can I get a cookie for knowing? :D
CyanBlue
04-15-2003, 10:44 PM
Um... Cookie... Cookie is bad for you...
If you still want, you can have one for the night...
No more than that though... :)
Don't forget to brush your teeth, alrighty??? :D
boyzdynasty
04-16-2003, 12:00 AM
*ah...goody goody*
mindfriction
07-24-2004, 10:22 AM
Alernative php method to stop caching of the php file
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
Another Issue?
Sometimes if your using "GET" in your sendAndLoad the querystring you are echo'ing/ printing back comes with a nice %20 appended at the start (if you have just done echo "var=some value" and not echo "&var=some value" ) and this will muckup the first name=value pair. Flash wont see the first variable in the querystring as var, rather %20var!
...Anyway thats just an issue ive come across, could be browser related (i'm using Mozilla 1.6 who knows)
boyzdynasty
07-26-2004, 03:29 AM
great tip! thx :)
Overmind81
04-30-2006, 10:21 AM
when u load in values like this
movie.swf?id=<?php echo "5"; ?>
this value is accessible only in _root, how do i get this in highest level like
_root.movie.wonnaData
?
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.