Flash Form To PHP with special character in the variables

Please post your general Flash Design questions here. Typically beginner questions fall into this category.

Flash Form To PHP with special character in the variables

Postby baoji1990 » Tue Jan 10, 2012 7:35 pm

Hello Guys,
I am new to this forum. I hope that someone can help me here.
I am using a ready made PHP form ( i cant edit it), and i should pass the following variables from flash:
t[name]
t[email]

but unfortunately flash does not support these characters "[" "]".
Please advise.
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby vamapaull » Wed Jan 11, 2012 1:46 am

Not sure I understand
Can you please elaborate ? Send a link? Some files?
User avatar
vamapaull
 
Posts: 4299
Joined: Mon Mar 13, 2006 11:31 am
Location: Bucharest, Romania
Flash Version: Adobe Flash CS5.5
Authoring Environment: Microsoft Windows

Re: Flash Form To PHP with special character in the variable

Postby baoji1990 » Wed Jan 11, 2012 9:49 am

Hello Paul,
Thank you for your reply, i will try to make it clearer:

I usually pass the variables from flash to php using the following method:
1- I create an input text in flash
2- I give it an instance name (example: name)
3- I send it to PHP using this code: lv.name = name.text; (then: lv.sendAndLoad("contact.php",lv,"POST");)
4- PHP read the variables through this code: $name = $_POST['name'];

Very simple process.
In my case, i can't edit the PHP file, and the variable is "t[name]" instead of "name"
However i can't use brackets for Flash instance names, and i don't know another way to pass these variables to PHP.

Hope i made it clear, and thank you for your assistance :)
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby vamapaull » Wed Jan 11, 2012 1:40 pm

Not sure what's your situation there and why exactly you can't modify the php file, but here is a nice tutorial that will show you another way of sending email through Flash and PHP:
http://gotoandlearn.com/play.php?id=50

I believe that will help you to make a contact form with your spacial variables.
User avatar
vamapaull
 
Posts: 4299
Joined: Mon Mar 13, 2006 11:31 am
Location: Bucharest, Romania
Flash Version: Adobe Flash CS5.5
Authoring Environment: Microsoft Windows

Re: Flash Form To PHP with special character in the variable

Postby baoji1990 » Wed Jan 11, 2012 9:12 pm

Thank Paul,
i will check the tutorial that you've mentioned now.
I cant edit the PHP files because it is a ready-made newsletter module.
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby baoji1990 » Fri Jan 13, 2012 7:39 am

It didn't help.
same problem, can not load variable with bracket "[" "]" from flash to php.
Please advise :(
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby vamapaull » Fri Jan 13, 2012 12:38 pm

You can send the variables from flash to php the usual way and then have the php change the variable names and contain the same info received from flash, then send those variables to the other php code that you can't modify.
User avatar
vamapaull
 
Posts: 4299
Joined: Mon Mar 13, 2006 11:31 am
Location: Bucharest, Romania
Flash Version: Adobe Flash CS5.5
Authoring Environment: Microsoft Windows

Re: Flash Form To PHP with special character in the variable

Postby baoji1990 » Fri Jan 13, 2012 9:25 pm

Paul that sounds great.
Can you please tell me more details about it? Like showing the PHP syntax? or sending me a link to a tutorial?
I really appreciate your help mate :D
Thanks
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby baoji1990 » Fri Jan 13, 2012 10:29 pm

Hello,
Thank you for your reply.
After thinking about your suggestion, i have figured out another solution. (i was wrong about the way i was thinking).

First Step:
I submit the variables from flash, then they are loaded into the php file. (working)

Second Step:
These variables should be submitted to a form through php. (usually people click on SUBMIT)
Is there a way to do it? (they should not see it)

I am sorry if i confused you, but i am really new to this kind of forms. I was used to deal with contact forms only.

Thanks
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby miels » Sat Jan 14, 2012 10:38 am

baoji1990 wrote:3- I send it to PHP using this code: lv.name = name.text; (then: lv.sendAndLoad("contact.php",lv,"POST");)
the variable is "t[name]" instead of "name"


Code: Select all
var o:Object = new Object();
         o["you can put pretty much anything in here: §$%&/()[]=?, numbers: 12356789, or even quotation marks: \" but as you can see, you have to escape it with a backslash"] = "hello";
         trace(o["you can put pretty much anything in here: §$%&/()[]=?, numbers: 12356789, or even quotation marks: \" but as you can see, you have to escape it with a backslash"]);
         


try:
lv.["t[name]"] = name.text;
miels
 
Posts: 174
Joined: Mon Sep 14, 2009 2:35 pm
Flash Version: Macromedia Flash (Older)
Authoring Environment: Microsoft Windows

Re: Flash Form To PHP with special character in the variable

Postby baoji1990 » Sun Jan 15, 2012 11:42 am

Hello,

If i use: lv.["t[name]"] = name.text;
I get the following error:
Scene=Scene 1, layer=Layer 1, frame=1, Line 1 Expected a field name after '.' operator.
baoji1990
 
Posts: 7
Joined: Tue Jan 10, 2012 7:34 pm
Flash Version: Adobe Flash CS5

Re: Flash Form To PHP with special character in the variable

Postby miels » Mon Jan 16, 2012 9:39 pm

Oh sorry, my bad.
Just leave the dot out:

lv["t[name]"] = name.text;
miels
 
Posts: 174
Joined: Mon Sep 14, 2009 2:35 pm
Flash Version: Macromedia Flash (Older)
Authoring Environment: Microsoft Windows


Return to General Flash

Who is online

Users browsing this forum: No registered users and 6 guests