Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 8th, 2003, 02:51 PM
Buggy Buggy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: India
Posts: 6 Buggy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old August 11th, 2003, 02:51 PM
jamieB jamieB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2002
Posts: 592 jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 56 m 16 sec
Reputation Power: 17
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.

Reply With Quote
  #3  
Old August 11th, 2003, 07:49 PM
Buggy Buggy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: India
Posts: 6 Buggy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Thanks Jamie

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.

Reply With Quote
  #4  
Old August 12th, 2003, 08:11 AM
jamieB jamieB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2002
Posts: 592 jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 56 m 16 sec
Reputation Power: 17
Quote:
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.

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...?

Reply With Quote
  #5  
Old August 12th, 2003, 08:13 AM
jamieB jamieB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2002
Posts: 592 jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 56 m 16 sec
Reputation Power: 17
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...?

Reply With Quote
  #6  
Old August 13th, 2003, 02:22 PM
Xty Xty is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 Xty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
echo "&message1=".$firstname;
Shouldn't this be: echo "&message1 = $firstname";

Reply With Quote
  #7  
Old August 13th, 2003, 02:25 PM
jamieB jamieB is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2002
Posts: 592 jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level)jamieB User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 56 m 16 sec
Reputation Power: 17
Quote:
Originally posted by Xty
echo "&message1=".$firstname;
Shouldn't this be: echo "&message1 = $firstname";


either is good

Reply With Quote
  #8  
Old August 14th, 2003, 08:34 AM
Buggy Buggy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: India
Posts: 6 Buggy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > php flash variable does not display value


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway