Jump to content


Photo

Macromedia Flash Site and PHP email POST


  • Please log in to reply
2 replies to this topic

#1 jrmgolem

jrmgolem
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationPoole, Dorset

Posted 06 June 2006 - 03:24 PM

I have a web template that is written in FLASH and has a feedback comment box that asks the user to enter thier name email and a comment.

The FLASH site uses an HTML file for data configuration, and the variable for the email adress is set as $recipient, I have looked in the tutorials and do not see how to get the email to be sent to me including the comment.

Within the FLASH code are the variables for $your_name $your_email and $message, is there an example in the tutorials to show me how to do the post form?

I appologise if this has been covered somewhere, but I couldnt find a search result for this that deals with FLASH and PHP.

Cheers! :-)

#2 digitalgod

digitalgod
  • Members
  • PipPipPip
  • Advanced Member
  • 374 posts

Posted 06 June 2006 - 03:53 PM

you need to have all of the input boxes and your button in the same MC and give it an instance name of formMC or whatever you want. You can also add a dynamic text box and give it a var of "status" so that people know what's going on when they submit the form

then on your button add

on (release) {
        if (!your_email.length || your_email.indexOf("@") == -1 || your_email.indexOf(".") == -1) {
        status = "Please enter a valid E-mail address";
    } 

    else if (!your_name.length) {
        status = "Please Enter your name before Sending";
    } 

    else if (!message.length) {
        status = "Please enter some text in you message";
    } 
    
    else {
        loadVariablesNum ("send.php", "0", "Post");
        status = "Sending... ";
    }
}

and in your send.php you do it like every other php form, you make it collect the info using $_POST and mail the message. To send back info to your status box just add

Print "_root.formMC.status=Your mail has been sent";

after your mail() function

[!--quoteo(post=380632:date=Jun 6 2006, 11:24 AM:name=AgentSmith)--][div class=\'quotetop\']QUOTE(AgentSmith @ Jun 6 2006, 11:24 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I have a web template that is written in FLASH and has a feedback comment box that asks the user to enter thier name email and a comment.

The FLASH site uses an HTML file for data configuration, and the variable for the email adress is set as $recipient, I have looked in the tutorials and do not see how to get the email to be sent to me including the comment.

Within the FLASH code are the variables for $your_name $your_email and $message, is there an example in the tutorials to show me how to do the post form?

I appologise if this has been covered somewhere, but I couldnt find a search result for this that deals with FLASH and PHP.

Cheers! :-)
[/quote]


#3 jrmgolem

jrmgolem
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationPoole, Dorset

Posted 06 June 2006 - 04:10 PM

Thank you very much for such a speedy response!

I have read the code you have provided, but I would be grateful of the corresponding PHP code as well, I have no clue what I am doing here LOL but I will try to post the flash code:


This is the code for the send action:

on (rollOver) {
    this.gotoAndPlay("s1");
}
on (releaseOutside, rollOut) {
    this.gotoAndPlay("s2");
}
on (release) {
    url_var = "server_option="+_root.server_option+"&recipient="+_root.recipient+"&your_name="+_parent.your_name+"&your_email="+_parent.your_email+"&message="+_parent.message;
    getURL("contact."+_root.server_option+"?"+url_var, "_self", "GET");
    _parent.your_name = "";
    _parent.your_email = "";
    _parent.message = "";
}

This is the code for the variables:

//t1.onSetFocus=function(){if(t1_2=="your name") {t1_2=""} }
t2.onSetFocus=function(){ if(your_email=="your e-mail") {your_email=""} }
t3.onSetFocus=function(){ if(message=="your comments here") {message=""} }
t4.onSetFocus=function(){if(your_name=="your name") {your_name=""} }


I hope this is clearer to you!

Thanks again




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users