2 Replies Latest reply on Sep 19, 2008 12:20 AM by isleepinafire

    Help needed getting contacts page to work

    DirkM1975
      Hi there,

      I’m new to flash programming, so please bear with me.

      I bought a flash template to customise to use for our wedding website. I’ve got pretty much most of it done, all except the contacts page, which I can’t get to work.

      I think I’ve narrowed the problem down to the feed into send_mail.php script, but any suggestions would be greatly appreciated (before my future wife kills me for wasting so much time on this when we could have got a simple html website – but where would be the fun in that?!)

      I've attached the Action script behind the contacts page (please excuse the Spanish – for some reason the scripts are littered with it – for those who need to know, boton = button, listo = ready, nombre = name, cuadro = picture).



      From what I can gather, the first bit deals with what happens when you click on the buttons (name and email), the second bit is for error checking what’s entered, such as whether the email address has a @ or .com. The last bit is to feed the results into a php file, which should forward the contents of the contacts page to me.

      Here’s my send_mail.php file

      <?php
      $nombre=$_POST['name'];
      $email=$_POST['email'];
      $phone=$_POST['company'];
      $comentarios=$_POST['msg'];

      $to="mail@mail.com";
      $subject="From flash form";
      $headers="From: \"$name\" <$email>";
      $message = "Company: $company\n\n";
      $message .= $msg;

      mail($to,$subject,$message,$headers);

      ?>


      And I've put this php file in the same directory of my website as all the other swf and fla files – is that correct?



      Should this work? Or have I made a mistake anywhere?

      Many thanks

      DM
        • 1. Re: Help needed getting contacts page to work
          isleepinafire
          Okay is the php script you have included here, THE actual script that is on your website? (unchanged in it's contents)



          Because where it says:
          $to="mail@mail.com";

          You have to change that to your email, or the email you want the form contents to send to.

          -Yes you will put the .php file in the same directory as the .swf file-

          Also you need to check that the variable and instance names in the flash file match the names in the .php file.

          Example:
          "mail.nombre = nombre.text;
          mail.email = email.text;
          mail.phone = phone.text;
          mail.comentarios = comentarios.text;
          mail.Submit = true;"
          -This is what you have provided for the form, which does not match the .php file provided.


          If the instance name of the email section is "email" the php file will read like this:
          email=$_POST['email'];

          The name inside the apostrophes is the instance name of that box.

          Looking at the scripts you have provided the instances and variables in the form do not match the ones in the .php file.



          If I am wrong, you can send me the original file if you wish and I can most likely find the problem for you and fix it.
          Or if you need help assessing this, I can do it for you! =P
          my email is stephanie@anarchidadesign.com

          Hope I helped.
          Cheers!
          • 2. Re: Help needed getting contacts page to work
            isleepinafire Level 1
            I did notice something else,

            on the last bottom script, (if this is the ACTUAL source of your code unchanged)

            I am sure your directory is not "www.website.com"


            var mail = new LoadVars();
            mail.nombre = nombre.text;
            mail.email = email.text;
            mail.phone = phone.text;
            mail.comentarios = comentarios.text;
            mail.Submit = true;
            mail.sendAndLoad(" http://www.website.com/send_mail.php", mail, "POST");
            nextFrame()

            You will have to change (" http://www.website.com/sendmail.php")
            to the actual name of your website! Otherwise it will not know what directory the .php file is in!