|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php flash variable does not display value
I am a newbie and having a problem with the values returned from PHP to Flash. I have tried using third party codes and the problem still persists. I will try to make a brief description here of what I have done and what is happening.
============================================== I have just used three controls on my flash form: 1) One Input box - variablename (firstname) 2) One button - clickHandler(go) 3) One dynamic Text box - variablename (message1) In the Action for the Button I have put the following Code: function go() { loadVariablesNum("hello.php",0,"POST"); } In the hello.php I have put the following Code: <?php echo "&message1=".$firstname; ?> In the dynamic text box I am getting the value as $firstname In the debug window corresponding to Message I get th is value "\".$firstname;\r\n?>" Please inform me why is it so. I am using Win2k Server with Flash MX and PHP server on Windows. Thanks in advance. Last edited by Buggy : August 8th, 2003 at 02:53 PM. |
|
#2
|
|||
|
|||
|
do you have register_globals turned on? If not, you should refer to $_POST["firstname"].....
you will get better results from LoadVars.sendAndLoad() here, because you want to do something with the data when it comes back, so you could forget about variable names and just name the textfield instances then write it as: Code:
response_lv = new LoadVars();
response_lv.onLoad = function(success) {
if(success) {
message1.text= = this.message1;
}else{
trace("problems loading hello.php!");
}
}
function go() {
var my_lv = new LoadVars();
my_lv.firstname = firstname.text;
my_lv.sendAndLoad("hello.php",response_lv);
}
that might seem like a lot more code but when you get onto real uses for this you will benefit from it a lot. |
|
#3
|
|||
|
|||
|
Hello Jamie,
Thanks for responding in. I have'nt tried it out the way you have mentioned it but I have found out that when the .swf file (that is created after publishing the same flash file) when run from the webserver directly does load all the values correctly. whereas in the Debug window in Macromedia I am getting all the values as $firstname, $lastname and so on. I have no idea why it is so. Can you help me out in this regard. ![]() |
|
#4
|
|||
|
|||
|
Quote:
how then do you see the values that have loaded, the ones which are different to those shown in the debugger? the debugger should just show you the values of the vars, I've not come across across it reporting a different value...? |
|
#5
|
|||
|
|||
|
whoops, OK just read your post properly
maybe this is to do with the fact that the flash authoring environment only sends data by GET, never POST - to test this stuff you need to publish first...? |
|
#6
|
|||
|
|||
|
echo "&message1=".$firstname;
Shouldn't this be: echo "&message1 = $firstname"; |
|
#7
|
|||
|
|||
|
Quote:
either is good |
|
#8
|
|||
|
|||
|
Thanks Jamie
Hello Jamie,
The information you provide is really enlightening. I did'nt realise this since I did not know how flash sends variables and data to the server. Thanks for the information. ![]() |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > php flash variable does not display value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|