A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: PHP EMAILER small problem, huge newb

  1. #1
    timmilgram.com
    Join Date
    Aug 2001
    Posts
    82

    PHP EMAILER small problem, huge newb

    Hi, I'm currently designing the website for my fraternity and i've created a form that sends variables to a php file that sends out emails and returns variables to the flash site telling it if it's sent or not. When running the form as its own seperate .swf, everything worked. However, when this .swf was loaded into the main .swf of the site (as _level1), the emails still got sent out through the php, meaning the .swf could talk to the php... BUT the php could not talk back to the form .swf for some reason. So the next thing I tried is to incorporate that form .swf into the main .swf of the site, as a movie clip on the main timeline. The same problem occurred: this means its 99.999% likely the target paths aren't set in the PHP to reach the variables inside the movieclip, but easily reaches it when the contents of the movieclip are on the main timeline. (I really hope you guys are following this). To clear things up a bit: I have a timeline with a movieclip currently on it that has a form in it. The form can communicate to the php but the php cant communicate back to the form. Basically, what I'm saying is that I'm a PHP newb and don't know to get it to reach the stuff inside the movie clip. The site is http://aepisb.brastart.com/ and the code in the PHP thats supposed to communicate back to the .swf is:

    $sendresult = "Thank you! You will receive a confirmation email shortly. ";
    $send_answer = "answer=";
    $send_answer .= rawurlencode($sendresult);
    echo "$send_answer";

    If anyone can help me I'll be the happiest newbie in the world.
    Thank you so much if you actually read this entire post.
    -Tim
    +++++++++++++++++++++++++++++++++

    +++++++++++++++++++++++++++++++++

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    you are probably using loadvariables to send and receive. Use a loadvars sendandload instead

    Musicman

  3. #3
    timmilgram.com
    Join Date
    Aug 2001
    Posts
    82
    I'm not too familiar with that. The code in my flash is as follows:

    fscommand("allowscale", "false");
    //
    // set some variables
    //
    mailform = "mailform.php";
    confirm = "please wait for confirmation ...";
    action = "send";
    //
    // and focus on variable fname
    //
    Selection.setFocus("fname");
    //
    // validate email function
    //
    function validate(address) {
    if (address.length>=7) {
    if (address.indexOf("@")>0) {
    if ((address.indexOf("@")+2)<address.lastIndexOf(".") ) {
    if (address.lastIndexOf(".")<(address.length-2)) {
    return (true);
    }
    }
    }
    }
    return (false);
    }
    //
    //form check
    //
    function formcheck() {
    if ((((email == null)) || (email.length<1)) || (email == "Enter a valid email.")) {
    email = "Enter a valid email.";
    action = "";
    }
    if (!validate(email)) {
    email = "Enter a valid email.";
    action = "";
    }
    if (fname == null) {
    fname = "Enter your full name.";
    action = "";
    }
    if (cname == null) {
    cname = "Enter your age/class level.";
    action = "";
    }
    if (telno == null) {
    telno = "Enter your phone number.";
    action = "";
    }
    if (comments == null) {
    comments = " y/n";
    action = "";
    }
    if (lname == null) {
    lname = "Enter a valid local address.";
    action = "";
    }
    if ((validate(email)) && (email != "ERROR!") && (fname != "") && (lname != "")) {
    action = "send";
    loadVariablesNum(mailform, 0, "POST");
    gotoAndPlay("wait");
    }
    }
    stop();


    ********************************
    Then on the "wait" frame, I have the following:
    ********************************
    loadVariablesNum(mailform, 0);
    answer = confirm;

    Then it plays a few frames and loops back to it until it gets a response from the php.



    I couldn't really figure out another way to do it. And its not quite working right now... so yea.
    Last edited by TM2k; 08-31-2005 at 06:33 PM.
    +++++++++++++++++++++++++++++++++

    +++++++++++++++++++++++++++++++++

  4. #4
    loadvars
    mylv = new LoadVars();
    mylv.onLoad = function() {
    // this will only go whenver the variables have loaded from the link below
    happydance = "fordawin";
    }
    mylv.load("http://www.whatever.com/myvars.php");

  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    your _first_loadvariablesum should be replaced by
    Code:
    mylv = new LoadVars();
    myreply = new loadvars();
    mylv.lname = lname;
    mylv.email = email; // need one line for every variable sent
    myreply.onLoad = function()
    {   answer = this.answer;// display php response
         play();
    }
    mylv.sendAndLoad('mail.php', myreply, 'POST');
    The second loadvariables never made any sense - it just made a second request to the server without sending any data

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center