AS2 Flash Contact Form

Posted by admin in Flash

Here is a working example of flash contact form with simple validations using ActionScript 2 and PHP mail function. This flash email form can also immediately response back to you if the email was sent successfully or failed. You can easily copy the contact form movie clip and paste it into an empty frame of any flash template.

flash contact form

You need to replace below red line with your email address in send_email.php file.

$receiver = “youremail@yourdomain.com”;

If your web server does not support PHP, you will need to use any other supported server side language for mail function instead of using send_email.php file.

UPDATES (24 June 2008): Adding Email Auto Response in send_email.php file

PHP:
  1. <?php
  2. $contact_name = $_POST[‘name’];
  3. $contact_email = $_POST[‘email’];
  4. $contact_subject = $_POST[’subject’];
  5. $contact_message = $_POST[‘message’];
  6.  
  7. if( $contact_name == true )
  8. {
  9. $sender = $contact_email;
  10. $receiver = “youremail@yourdomain.com”;
  11. $client_ip = $_SERVER[‘REMOTE_ADDR’];
  12.  
  13. $email_body = “Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip \nFlash Contact Form provided by http://www.flashmo.com”;
  14. $email_body_auto_reply = “Hello $contact_name, \nThis is the auto reply message. Thank you. \nAdmin – http://www.flashmo.com”;
  15.  
  16. $extra = “From: $sender\r\n . “Reply-To: $sender \r\n . “X-Mailer: PHP/” . phpversion();
  17. $extra_auto_reply = “From: $receiver\r\n . “Reply-To: $receiver \r\n . “X-Mailer: PHP/” . phpversion();
  18.  
  19. mail( $sender, “Auto Reply – Re: $subject”, $email_body_auto_reply, $extra_auto_reply );    // auto reply mail to sender
  20.  
  21. if( mail( $receiver, “Flash Contact Form – $contact_subject”, $email_body, $extra ) )
  22. {
  23. echo “success=yes”;
  24. }
  25. else
  26. {
  27. echo “success=no”;
  28. }
  29. }
  30. ?>

UPDATES (22 July 2008): Error correction in send_email.php file

Please change $subject to $contact_subject in line number 15.

PHP:
  1. if( mail( $receiver, “Flash Contact Form – $contact_subject”, $email_body, $extra ) )

Feel free to drop a comment if you have any question or feedback.

Related Post: Flash Contact Form in ActionScript 3