Solved

Using Flash to Submit to PHP

Posted on 2008-09-29
5
236 Views
Last Modified: 2013-11-11
I am trying to use a flash form to submit to a PHP script.

I've followed a simple tutorial where I add a text box and a button.

The text box is set to Input Text and on the button I have the following script:

on(release) {
      getURL('test.php', '', 'POST');
}

All seems to be working except that when I do a print_r($_POST); I get the following:

Array
(
    [q] => <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">fdsafdsafdsa</FONT></P></TEXTFORMAT>
)

Is there any way to get the data that is in the flash var without all this other crap or must I now parse this with php to get the value that I'm looking for?
0
Comment
Question by:Hube02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 37

Assisted Solution

by:CyanBlue
CyanBlue earned 250 total points
ID: 22598698
getURL() function automatically passes all the variables in its scope...  
You should really use LoadVars.sendAndLoad() function and specify what you want to pass...

So, it'd be something like this...

CyanBlue
var _lv:LoadVars = new LoadVars();
_lv.variableToSend = someTextField.text;
_lv.sendAndLoad("test.php", _lv, "POST");
_lv.onLoad = function (ok) {}

Open in new window

0
 
LVL 18

Author Comment

by:Hube02
ID: 22598788
Changing my line with getURL() to the above appears to do nothing at all.

I need this to work just like a normal form with the action of "test.php" an the method of "post" where the broswer goes to that URL and that url process the from and then displays some output.

As I said, I'm following the tutorials I've found and they all use the getURL() function and none of them say anything about getting past an XML string of junk.
0
 
LVL 18

Author Comment

by:Hube02
ID: 22599327
Well, this is what I did...

The instance name of my text field is "SearchTerm"

I changed my script to the following:

on(release) {
      var q:String = SearchTerm.text;
      getURL('test.php', '', 'POST');
}

Other than this everything else is the same as ALL the tutorials that I've found. You'd think that they would not miss this simple step in a tutorial or to at least tell you in the tutorial that what you really get is all the formatting of a text field if you don't do something to change it.

My question is, why would they think we'd want all that crap to begin with?

Anyway, problem solved
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 22612774
It probably is the case where the tutorials are dealing with the regular textField but you are dealing with the HTML enabled textField...

At any rate, the purpose of the tutorial is that you learn specific item in a quick manner...  You should not rely on those because there are many that are written poorly...  I'd stick with the Flash manual to learn the specific stuff...  I've got to admit that Flash manual is not the most intuitive material you can study, but it's got vast information that's viable to survive in this AS world...  ;)

At any rate, glad to hear that you've got it sorted out...  ;)

CyanBlue
0
 
LVL 18

Accepted Solution

by:
Hube02 earned 0 total points
ID: 22613297
Thanks for the info. As you can guess, I'm not a flash person. This project just got dumped on me. I was given a flash file that was supposed to have two forms in it, one for a search and another simple contact form, and told "Make it work." Always fun, an annoying...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question