2 Replies Latest reply on Jan 15, 2008 1:27 PM by DrTongue

    Trouble submitting contact form data

      I am having trouble getting the data in my contact form to submit to the formmail.php script on my server. I made an HTML version of the form and it works fine. But the data is not sending from the Flash site. The form has the following fields:

      mySubmit (button)

      I have scavenged the web for help and pieced together the following code which I placed in the actions frame of the contact form.

      mySubmit.onRelease = function() {
      infoToSend = new LoadVars();

      serverResponse = new LoadVars();

      infoToSend.FirstName = FirstName.text;
      infoToSend.LastName = LastName.text;
      infoToSend.Phone = Phone.text;
      infoToSend.email = email.text;
      infoToSend.subject = Subject.text;
      infoToSend.MessageArea = MessageArea.text;

      serverResponse.onLoad = function(success:Boolean) {
      if(success) {
      } else {
      // do something else

      The server response appears to work because upon clicking the Submit button, it progresses to frame 2 as indicated. Does anyone see what I'm doing wrong? Any help would greatly be appreciated. Thanks.
        • 1. Re: Trouble submitting contact form data
          Greg Dove Level 4
          A few quick comments:
          1. Do your textfields have the instance names (in the property inspector)
          FirstName, LastName etc.
          (Don't use the 'variable' field in the property inspector for each textfield)

          2. I'm not sure about this, in fact I don't think this will make a difference... I always need to do a quick test and can't remember.... but if your textfields are in the same timeline as the button, then perhaps you need to reference the textfields like this;
          infoToSend.FirstName = this._parent.FirstName.text;

          3. If you're testing from flash itself, it won't work as it is (depends on you php script). This is because the POST method doesn't work from the flash test environment. You need to try it in a browser.

          • 2. Re: Trouble submitting contact form data
            DrTongue Level 1
            Thanks for your input. After several tweaks and attempts, I'm still at square one though. Each textfield does have an instance name. I tried adding this._parent. to each textfield but it didn't seem to have any effect. All testing is done online in a browser.

            As I mentioned before, the PHP script works fine when I send data to it from an HTML form. It seems to me that Flash is not even sending data out upon clicking the submit button.

            Any other thoughts? Tricks? or anything I may be missing?