6 Replies Latest reply on Jul 25, 2008 12:58 AM by Noelbaland

    Flash fails to access .php file?

      I'll be straight... sendAndLoad appears to fail sending the variables to the .php file. I don't know why but both files have read and read&execute permissions. I've tried making a temporary form in html, and the php file responds correctly. Also, both files are in the same directory assigned to the same site on a Windows2k3 / IIS 6 system.
      So i thought since html form worked there must be some problem between the communication of the swf file with the php one.
      Any ideas?
      Here's the code for sending the data into the php.
        • 1. Re: Flash fails to access .php file?
          Noelbaland Level 1

          You need to set up 2 LoadVars objects. One to send your form data to PHP and the other to recieve the response.

          This part is fine

          on (release) {
          var loadVar = new LoadVars();
          loadVar.onLoad = function(success:Boolean){
          if (success) {
          } else {

          But for this part you should create another LoadVars object

          var sendVars = new LoadVars();
          sendVars.foename = foename.text;
          sendVars.surname = surname.text;
          sendVars.email = email.text;
          sendVars.subject = subject.text;
          sendVars.texts = comments.text;
          sendVars.sendAndLoad(" http://www.freshways.gr/email.php", loadVar, "POST");

          Try that and see if that helps
          • 2. Re: Flash fails to access .php file?
            K0raX Level 1
            Nope it appears that that doesnt work either... =/
            Any other ideas?
            • 3. Re: Flash fails to access .php file?
              Noelbaland Level 1
              OK, try moving the script up to the timeline and giving your button an instance name (I've used send_btn).
              Also, just checking, but is your PHP script sending back a response similar to the one below.
              • 4. Re: Flash fails to access .php file?
                K0raX Level 1
                Thanks i'll try that and post back.
                No i didnt add a response since i only need to know wether it could talk with the file or not. The .php is used to send email but here's the thing... it would send the email (so it opens the php file) but all $_POST variables came out as "undefined". Since it worked with html i presumed it should be the link between the .swf and .php.
                • 5. Flash fails to access .php file?
                  K0raX Level 1
                  Ok... i finally found out that the

                  and all the others are returning undefined.....
                  Your code helped after all.. now it says it sent the email but when i check it it just says undefined undefined undefined everywhere.
                  The code for sending is located in a frame but the input texts are located in a movie clip. Could that affect it?...

                  EDIT: Nevermind... it turns out it DID affect it so it was all my mistake =)
                  Thanks for everything Noel
                  EDIT2: @ Noel's response below... i already tried that it still didn't work... i placed the button INSIDE the movie clip and now it works fine.
                  • 6. Re: Flash fails to access .php file?
                    Noelbaland Level 1
                    Yes. Change the script to target the moviclip first and then the form variables.