4 Replies Latest reply on Sep 17, 2006 7:08 AM by tautvis

    Problem with loadVariables to a PHP

    elemi
      Hi guys!

      I´m working with Flash 8 and start experiencing some problems.

      I have a Flash form that loads a PHP which will send an e-mail with the collected information. In Flash 7 I hadn´t any problem but in Flash 8 the e-mail arrives with all the HTML tags.

      Here´s the Flash code on the submit button of the form:

      on (release) {
      if ((this.nombre_txt == "") || (this.nombre_txt == "Ingrese su nombre")) {
      this.nombre_txt="Ingrese su nombre";
      this.stop();
      } else if ((this.email_txt.indexOf("@") != -1) && (this.email_txt.indexOf(".") != -1) && (length(this.email_txt)>5)) {
      this.loadVariables("contacto.php", "GET");
      gotoAndStop(40);
      } else {
      this.email_txt="Ingrese su e-mail";
      this.stop();
      }
      }

      Here´s the code in the PHP:

      <html><head><title>Contacto desde el sitio</title></head>
      <body>
      <?php

      extract($HTTP_GET_VARS);

      $recipient = "emi@emilianorodriguez.com.ar";
      $subject = "Contacto desde el sitio";
      $message .= "Contacto desde el sitio\n";
      $message .= "---------------------------------------------------------------------------\n";
      $message .= "Nombre y Apellido: $nombre_txt\n";
      $message .= "Empresa: $empresa_txt\n";
      $message .= "Tel: $tel_txt\n";
      $message .= "E-mail: $email_txt\n";
      $message .= "\n";
      $message .= "Producto en el que está interesado: $producto\n";
      $message .= "\n";
      $message .= "Comentarios: $comentarios_txt\n";
      $message .= "\n";

      mail($recipient,$subject,$message,"From: <$email_txt>");


      ?>
      </body>
      </html>


      And here is what I get in my e-mail:

      Contacto desde el sitio
      ---------------------------------------------------------------------------
      Nombre y Apellido: <P ALIGN=\"LEFT\"><FONT FACE=\"FoundrySterling Medium\" SIZE=\"12\" COLOR=\"#FF9900\" LETTERSPACING=\"0\" KERNING=\"0\">ttttttttttttttttt</FONT></P>
      Empresa: <P ALIGN=\"LEFT\"><FONT FACE=\"FoundrySterling Medium\" SIZE=\"12\" COLOR=\"#FF9900\" LETTERSPACING=\"0\" KERNING=\"0\">tttttttttttttttttttttt</FONT></P>
      Tel: <P ALIGN=\"LEFT\"><FONT FACE=\"FoundrySterling Medium\" SIZE=\"12\" COLOR=\"#FF9900\" LETTERSPACING=\"0\" KERNING=\"0\">ttttttttttttttttttttttttttttt</FONT></P>
      E-mail: <P ALIGN=\"LEFT\"><FONT FACE=\"FoundrySterling Medium\" SIZE=\"12\" COLOR=\"#FF9900\" LETTERSPACING=\"0\" KERNING=\"0\">emi@netminds.com.ar</FONT></P>

      Producto en el que está interesado:

      Comentarios: <P ALIGN=\"LEFT\"><FONT FACE=\"FoundrySterling Medium\" SIZE=\"12\" COLOR=\"#FF9900\" LETTERSPACING=\"0\" KERNING=\"0\">ssssssssssssssssssssssssssssssss</FONT></P>


      Could you please let me know how can I solve this. I think I should use LoadVars but have tried with that and can´t make it work.

      Thanks!

      Emiliano
        • 1. Re: Problem with loadVariables to a PHP
          rickLep
          Hi,

          are the input fields in your form set to html-text? If so, Flash will automatically generate html tags. You should set your textfields to 'normal text'. (The 'render text as HTML' box should not be selected, or the textboxInstanceName.html = false (standard setting) should be set.

          Regards,
          Rick,
          • 2. Re: Problem with loadVariables to a PHP
            elemi Level 1
            Thanks Rick,

            I´ve tried with that... tried with all the anti alias too (when I tried with "Use device fonts" I can´t write anything on the fields) and it keeps arriving with all the HTML tags. I repeat... with Flash 7 I did the same thing and the e-mails arrived without tags.

            Any other idea of how can I get rid of them?

            Thanks again!
            • 3. Re: Problem with loadVariables to a PHP
              rickLep Level 1
              Hi Elemi,

              it could be the loadVariables function, but I don't have too much experience with that function since I use the LoadVars in combination with send and load and I haven't run into the html tags problem, so that could be the solution, since loadVariables is an older function.

              With LoadVars you should create a LoadVars object:
              var myLoadVars:LoadVars = new LoadVars();

              Fill the LoadVars with data:
              myLoadVars.name = a;
              myLoadVars.eMail = a@b.c.com;

              Send the vars:
              myLoadVars.send("script.php", "GET");

              If you want the script to return data to Flash, you should use sendAndLoad:
              myLoadVars.sendAndLoad("script.php", myLoadVars, "GET");

              In this case you should attach an onLoad function to the LV object to receive the data:
              myLoadVars.onLoad = function(success:Boolean){
              if(succes){
              //your actions here
              } else {
              //error
              }
              }
              You can also target another LV object to receive the vars. In that case change the name between the ( ).

              I hope this helps...

              Best regards,
              Rick.