7 Replies Latest reply on Jun 7, 2011 11:22 PM by pantelis224466

    Contact form and incoming results

    pantelis224466

      Hi there.

      I use a xml contact form which is consists of these files:

       

      contact_form.php

      <?php
      $sendTo = "info@mymail.gr";
      $subject = "Φόρμα συμπλήρωσης ενδιαφέροντος από mysite.gr";
      $message = $_GET['message'];
      $email = $_GET['email'];
      $name = $_GET['name'];
          //send mail
          $headers  = "Από: $email\r\n";
          $headers .= 'MIME-Version: 1.0' . "\r\n";
          $headers .= 'Content-type: text/html; charset=iso-UTF-8' . "\r\n";
          $msg = "Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο mysite.gr:\n\nΌνομα:".$name."\n\nE-mail:".$email."\n\nΜήνυμα:".$message."";
          mail($sendTo, $subject, $msg, $headers);
          echo "status=formOk";
      ?>

       

      contact.xml

      <?xml version="1.0" encoding="utf-8" ?>
      <contacts><![CDATA[Παρακαλουμε, συμπληρωστε τη φορμα με τα στοιχεια σας και το λογο εκδηλωσης ενδιαφεροντος και θα επικοινωνησουμε μαζι σας το συντομοτερο δυνατο. Ευχαριστουμε]]></contacts>

       

      and the contact.swf.

      Inside the .swf the send function is this:

       

      function sendForm () {
          send_lv.name = formTitles.nameInput.text;
          send_lv.email = formTitles.emailInput.text;
          send_lv.message = formTitles.messageInput.text;
          //
          if ((formTitles.nameInput.text != "") and (formTitles.nameInput.text != "Πληκτρολογήστε το όνομά σας") and (formTitles.emailInput.text != "") and (formTitles.emailInput.text != "Πληκτρολογήστε το email σας") and (formTitles.emailInput.text.indexOf ("@", 0) != -1) and (formTitles.emailInput.text.indexOf ('.', 0) != -1) and (formTitles.messageInput.text != "") and (formTitles.messageInput.text != "Πληκτρολογήστε το μήνυμά σας")) {
              formTitles.sendBT.bt.enabled = false;
              send_lv.sendAndLoad ("contact_form.php",result_lv,"GET");
          }
          else {
              validateForm ();
          }
          //  
          result_lv.onLoad = function (success:Boolean) {
              if (success) {
                  formTitles.statusTxt.text = "Το μήνυμα εστάλη επιτυχώς";
                  if (result_lv.status == "formOk") {
                      formTitles.sendBT.bt.enabled = true;
                      cleanForm ();
                  }
              }
              else {
                  formTitles.statusTxt.text = "Αποτυχία αποστολής";
                  //trace ("server error");
              }
          };
      }

       

      When i get the results of the form at my email. i get squares with question marks (�) at message and name values which have been inserted by the user. The rest mail appears just fine (subject, msg and email). I have embedded greek characters at my dynamic texts in .swf but i have no results. I also have saved all my files at UTF-8.

       

      Any ideas?

       

      I would appreciate if someone could answer this question

        • 1. Re: Contact form and incoming results
          kglad Adobe Community Professional & MVP

          try changing your php header:

           

          <?php
          $sendTo = "info@mymail.gr";
          $subject = "Φόρμα συμπλήρωσης ενδιαφέροντος από mysite.gr";
          $message = $_GET['message'];
          $email = $_GET['email'];
          $name = $_GET['name'];
              //send mail
              $headers  = "Από: $email\r\n";
              $headers .= 'MIME-Version: 1.0' . "\r\n";
              $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
              $msg = "Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο mysite.gr:\n\nΌνομα:".$name."\n\nE-mail:".$email."\n\nΜήνυμα:".$messa ge."";
              mail($sendTo, $subject, $msg, $headers);
              echo "status=formOk";
          ?>

           

          if that fails, try:

          <?php
          $sendTo = "info@mymail.gr";
          $subject = "Φόρμα συμπλήρωσης ενδιαφέροντος από mysite.gr";
          $message = $_GET['message'];
          $email = $_GET['email'];
          $name = $_GET['name'];
              //send mail
              $headers  = "Από: $email\r\n";
              $headers .= 'MIME-Version: 1.0' . "\r\n";
              $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
              $msg = "Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο mysite.gr:\n\nΌνομα:".$name."\n\nE-mail:".$email."\n\nΜήνυμα:".$messa ge."";
              mail($sendTo, $subject, $msg, $headers);
              echo "status=formOk";
          ?>
          1 person found this helpful
          • 2. Re: Contact form and incoming results
            pantelis224466 Level 1

            I tried to change this:

             

            $headers .= 'Content-type: text/html; charset=iso-UTF-8' . "\r\n"; to

            $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; nothing happened and then i changed this:

             

               $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; to

               $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

             

            but nothing happened again.

            Should i change  the encoding of the saved file to something else? (i have it as UTF-8)

            • 3. Re: Contact form and incoming results
              kglad Adobe Community Professional & MVP

              the php file?   no,  that's ok if you're getting email.

               

              wait a minute.  the greek text in your $message is coming through ok?  if yes,try escaping the text you're sending from flash.

              • 4. Re: Contact form and incoming results
                pantelis224466 Level 1

                I get the red text at greek and i have an encoding problem with the purple text at the incoming email.

                 

                $msg = "Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο  mysite.gr:\n\nΌνομα:".$name."\n\nE-mail:".$email."\n\nΜήνυμα:".$message."";

                 

                Example of the incoming email:

                Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο sm-arch.gr:  Όνομα:�������ò ����������ò E-mail:pm4698@gmail.com Μήνυμα: �����á ��á �������Ü

                • 5. Re: Contact form and incoming results
                  kglad Adobe Community Professional & MVP

                  so, try:

                   


                   

                  function sendForm () {
                      send_lv.name = escape(formTitles.nameInput.text);
                      send_lv.email = escape(formTitles.emailInput.text);
                      send_lv.message = escape(formTitles.messageInput.text);

                      //
                      if ((formTitles.nameInput.text != "") and (formTitles.nameInput.text != "Πληκτρολογήστε το όνομά σας") and (formTitles.emailInput.text != "") and (formTitles.emailInput.text != "Πληκτρολογήστε το email σας") and (formTitles.emailInput.text.indexOf ("@", 0) != -1) and (formTitles.emailInput.text.indexOf ('.', 0) != -1) and (formTitles.messageInput.text != "") and (formTitles.messageInput.text != "Πληκτρολογήστε το μήνυμά σας")) {
                          formTitles.sendBT.bt.enabled = false;
                          send_lv.sendAndLoad ("contact_form.php",result_lv,"GET");
                      }
                      else {
                          validateForm ();
                      }
                      //  
                      result_lv.onLoad = function (success:Boolean) {
                          if (success) {
                              formTitles.statusTxt.text = "Το μήνυμα εστάλη επιτυχώς";
                              if (result_lv.status == "formOk") {
                                  formTitles.sendBT.bt.enabled = true;
                                  cleanForm ();
                              }
                          }
                          else {
                              formTitles.statusTxt.text = "Αποτυχία αποστολής";
                              //trace ("server error");
                          }
                      };
                  }

                   

                   

                  and use POST instead of GET

                  1 person found this helpful
                  • 6. Re: Contact form and incoming results
                    pantelis224466 Level 1

                    I changed the 3 lines as you suggested. Then i changed this line:

                       send_lv.sendAndLoad ("contact_form.php",result_lv,"GET");

                    to:

                       send_lv.sendAndLoad ("contact_form.php",result_lv,"POST");

                    and i got blank values.

                     

                    Then in .php file i changed the word GET with the word POST and i tried the encodings: UTF-8, iso-UTF-8 and iso-UTF-8 and i got these results:

                     

                    Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο sm-arch.gr: Όνομα:%D0%E1%ED%F4%E5%EB%DE%F2 E-mail:info%40p%2Dmech%2Egr Μήνυμα:%C3%E5%E9%DC

                    Οι ακόλουθες πληροφορίες καταχωρήθηκαν από τον ιστότοπο sm-arch.gr: Όνομα:%D0%E1%ED%F4%E5%EB%DE%

                    F2%20%CC%F0%EF%F5%E4%E1%EB%DC%EA%E7%F2%20 E-mail:info%40p%2Dmech%2Egr Μήνυμα:%C3%E5%E9%DC%20%F3%EF%F5%20%CC%E1%F1%DF%E1%0D
                    • 7. Re: Contact form and incoming results
                      pantelis224466 Level 1

                      Here is a link from where you can download my contact form folder to take a look at it:

                      www.p-mech.gr/panel/contact_form.zip