Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Frustrating Enquiry PHP form in Flash CS3

Options
  • 19-02-2010 4:57pm
    #1
    Registered Users Posts: 896 ✭✭✭


    Hi Guys

    First off I've very little programming experience, especially PHP but doing a 2 pager flash site for a friend of mine, all movies/buttons etc are working fine and I have a comment/email enquiry form on page 2 (scene 1, frame 1) and a thank you on frame 2 (all codes etc work fine).

    Now to the PHP bit (this code was taken from a sample on the net that works perfectly when downloaded and subsequently uploaded to my website with the accompanying email.php file)

    I have set up a movie titled "form" with 5 text input fields with vars as follows (name, phone, email, area, enquiry)

    There is a code on the submit button as follows:

    on (release) {
    // send variables in form movieclip (the textfields)
    // to email PHP page which will send the mail
    form.loadVariables("email.php", "POST");
    }



    I've got the following code on the form movie to bring you to the thank you frame:

    onClipEvent(data){
    // show welcome screen
    _root.nextFrame();
    }


    And finally the email.php code (obviously I've change the recipient's email address)

    <?php
    /***************************************************\
    * PHP 4.1.0+ version of email script. For more
    * information on the mail() function for PHP, see
    * http://www.php.net/manual/en/function.mail.php
    \***************************************************/


    // First, set up some variables to serve you in
    // getting an email. This includes the email this is
    // sent to (yours) and what the subject of this email
    // should be. It's a good idea to choose your own
    // subject instead of allowing the user to. This will
    // help prevent spam filters from snatching this email
    // out from under your nose when something unusual is put.

    $sendTo = "nialler@myownwebsite.ie";
    $subject = "Website Enquiry";

    // variables are sent to this PHP page through
    // the POST method. $_POST is a global associative array
    // of variables passed through this method. From that, we
    // can get the values sent to this page from Flash and
    // assign them to appropriate variables which can be used
    // in the PHP mail() function.


    // header information not including sendTo and Subject
    // these all go in one variable. First, include From:
    $headers = "From: " . $_POST["name"];
    $headers = "<" . $_POST["email"] .">\r\n";
    // next include a replyto
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    // often email servers won't allow emails to be sent to
    // domains other than their own. The return path here will
    // often lift that restriction so, for instance, you could send
    // email to a hotmail account. (hosting provider settings may vary)
    // technically bounced email is supposed to go to the return-path email
    $headers .= "Return-path: " . $_POST["email"];

    // now we can add the content of the message to a body variable
    $message = $_POST["phone"];
    $message = $_POST["area"];
    $message = $_POST["enquiry"];

    // once the variables have been defined, they can be included
    // in the mail function call which will send you an email
    mail($sendTo, $subject, $message, $headers);

    ?>


    Works perfectly for the sample that I downloaded, won't work at all when I incorporate it into my own flash website, I've checked the code tons and tons of times but doesn't seem to be doing anything.

    Any help would be appreciated, even a simple mailto: at this stage would be great.

    Niall


Advertisement