3 Replies Latest reply on May 29, 2008 11:15 AM by kglad

    Flash and PHP

    collosal-G
      Hi all,

      I am having a hard time getting Flash to pass variables to a PHP file, which then mails the info to an email recipient. The email only gets sent when I hard code the email address in the PHP file, rather than have Flash send it. In fact, any hard coded data I put in the PHP file is making it, but the variables are coming up empty.

      Any insight would be greatly appreciated.

      Thanks,
      g

      FLASH CODE:
      // Request Info Form
      var formComplete:Boolean = false;

      var myVars:LoadVars = new LoadVars();
      myVars.onData = function (results:String) {
      // Confirm Submission
      notify_mc.gotoAndStop ("sent");
      }

      function submitNotification (fieldNumber) {
      // Set Variables
      myVars.recipient = "emailAddress@yahoo.com";

      myVars.name = notify_mc.input1_txt.text;
      myVars.email = notify_mc.input2_txt.text;
      myVars.learn = notify_mc.input3_txt.text;
      myVars.first = notify_mc.input4_txt.text;
      myVars.phone = notify_mc.input5_txt.text;

      myVars.sendAndLoad("phpFile.php", myVars, "POST");
      notify_mc.gotoAndStop ("sending");
      }
      }


      PHP CODE:
      <html>
      <head><title>Request Info</title></head>
      <body>
      <?php

      // Client Email Address (Flash Var)
      $email_recipient=$recipient;

      // Client Email Address (Hard Code)
      $email_recipient="emailAddress@yahoo.com";

      // Client Subject Line
      $subject_recipient="Product Information Request";

      // Client Intro Message
      $message_recipient="Information Request Received From ".$name;

      // Customer Reply Subject line
      $subject_sender="Product Information";

      // Customer Reply Message
      $message_sender="Thank you for your interest. You will be notified by email when the product is available for purchase.";

      // Do Not Remove
      $message=str_replace("\\\"","\"",$message);
      $message=str_replace("\'","'",$message);
      urlencode ($text);
      $message=str_replace("%0D","\n",$message);

      // Message
      $inhalt=$message_recipient."\n\n"."Name: ".$name."\n\n"."Email Address: ".$email."\n\n"."How did you find out about the product?: ".$learn."\n\n"."Is the your first widget?: ".$first."\n\n"."What phone do you currently use?: ".$phone;


      // Mail Response
      mail($email_recipient,$subject_recipient,$inhalt,"From: ".$name);
      mail($_REQUEST["email"],$subject_sender,$message_sender,"From: ".$email_recipient);

      ?>
      </body>
      </html>