4 Replies Latest reply on Apr 23, 2007 4:31 PM by kglad

    Flash to PHP

      NEWBIE ALERT: I've created a flash form (taking bits of code from Motion Maker & others). It is capturing the data just fine - and forwarding it as well - but my value test isn't quite working and it's getting stuck in a loop. not sure if the problem is in the test or in the php.

      On Frame 1:
      var return_lv:LoadVars = new LoadVars();
      var send_lv:LoadVars = new LoadVars();
      var scriptUrl:String = "DWBEmailer.php";
      return_lv.onLoad = function(success:Boolean) {
      if (success)
      _root.errTitle = "Error!";
      _root.errType = "Attention, an error occurred. Please try again later.";

      Then, on the <submit> button (on Frame 2):

      var DWBEmail:LoadVars = new LoadVars();
      DWBEmail.flName = contactName;
      DWBEmail.mail = contactEmail;
      DWBEmail.comments = contactMessage;
      DWBEmail.sendAndLoad(scriptUrl, return_lv, "POST");

      As I said, data capture and email generation is FINE. it's just not coming out of the loop and moving on to the next frame after activating the PHP script.

        • 1. Re: Flash to PHP
          kglad Adobe Community Professional & MVP
          send_lv is unneeded. and your php script needs to return something to flash for your return_lv.onLoad method to execute. you can use an echo statement.
          • 2. Re: Flash to PHP
            Kevin_Susman Level 1

            thanks for spotting the send_lv - that's an artifact I have to get rid of.

            I have this in my php -

            $sendTo = "duck@duckwalksintoabar.com";
            $subject = "Online Contact Form Submission";

            $headers = "From: " . $_POST["flName"] ." <" . $_POST["mail"] .">\r\n";
            // next include a replyto
            $headers .= "Reply-To: " . $_POST["mail"] . "\r\n";
            $headers .= "Return-path: " . $_POST["mail"];

            // now we can add the content of the message to a body variable
            $message = $_POST["comments"];

            // once the variables have been defined, they can be included
            // in the mail function call which will send you an email
            mail($sendTo, $subject, $message, $headers);

            I don't really know where (or how) to put the echo statement in. I think it's something like: echo "&return_lv="success"

            • 3. Re: Flash to PHP
              Kevin_Susman Level 1
              OK. Figured it out. Thanks, Kglad - you somehow intuited me in the right direction anyway!
              • 4. Re: Flash to PHP
                kglad Adobe Community Professional & MVP
                you're welcome.