Solved

Using Flash to Submit to PHP

Posted on 2008-09-29
5
237 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

752 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