0 Replies Latest reply on Jan 13, 2011 4:57 PM by pchinique

    having problems with a php form, it works but i don't get the email address of the sender

    pchinique Level 1

      I'm using a flash form with a php to send the data. I get the response from the checkboxes but not the email from the sender. I'm not sure what I'm doing wrong. Since I'm using Actionscript for the flash form and PHP for the POSTmethod, I'm not sure which forum will be the right one to post this.

       

      Here is the php code:

       

      <?php

       

      // Create local variables from the Flash ActionScript posted variables

       

      $senderEmail = $_POST['eMail'];
      $senderNewsletter1 = $_POST['bead'];
      $senderNewsletter2 = $_POST['jewelry'];
      $senderNewsletter3 = $_POST['onlineNewsletter'];
      $senderNewsletter4 = $_POST['sandiegoNewsletter'];

       

      // Strip slashes on the Local typed-in variables for security and run any php based error check here

       

      $senderEmail = stripslashes($eMail);
      $senderMessage = stripslashes($senderMessage);

       


      // IMPORTANT - Change these lines to be appropriate for your needs - IMPORTANT !!!!!!!!!!!!!!!!!!
      $to = "info@southsunbeads.com";            
      $from = "info@southsunbeads.com";
      $subject = "Response from game2";
      // Modify the Body of the message however you like
      $message = "Results from the form:

       


      e-mail: $senderEmail
      Bead deal of the day: $senderNewsletter1
      Jewelry deal of the day: $senderNewsletter2
      online Newsletter: $senderNewsletter3
      San Diego Newsletter: $senderNewsletter4

       

       

       


      $senderMessage";
      // Build $headers Variable
      $headers = "From: $from\r\n";
      $headers .= "Content-type: text\r\n";
      $to = "$to";
          // Send the email
          mail($to, $subject, $message, $headers);
         
          // Assemble the message that goes back to Flash
          // The flash ActionScript is looking for a return variable of "return_msg" there is no sendername in my form, can be just change to generic message
          $my_msg = "Thanks $senderName, all data has been sent.";
          // Print the data back to flash who is patiently waiting for it in the onCompleteHandler
          print "return_msg=$my_msg";
      // Exit script   
      exit();
      ?>

       


      -------AND HERE IS THE ACTIONSCRIPT CODE------

       


      import flash.net.URLVariables;
      import flash.net.URLRequest;

       

      /* Mouse Click Event
      Clicking on the specified symbol instance executes a function in which you can add your own custom code.

       

      Instructions:
      1. Add your custom code on a new line after the line that says "// Start your custom code" below.
      The code will execute when the symbol instance is clicked.
      */

       


      submit.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

       

      function fl_MouseClickHandler(event:MouseEvent):void
      {
         
         
          if (eMail.text == ""){
              eMail.text = "Please enter in your email address";
          }
          else{
              // Start your custom code
          // create a variable container
          var allVars:URLVariables = new URLVariables();
          allVars.eMail = eMail.text;
          allVars.bead = bead.selected;
          allVars.jewelry = jewelry.selected;
          allVars.onlineNewsletter = onlineNewsletter.selected;
          allVars.sandiegoNewsletter = sandiegoNewsletter.selected;
          //send info to URL
          var mailAddress:URLRequest = new URLRequest("http://www.southsunbeads.net/form.php");
          mailAddress.data = allVars;
          mailAddress.method = URLRequestMethod.POST;
          sendToURL(mailAddress);
              thankyou.text = "Thank you!";
          }
      }

       

       

       

      Thanks