Flash PHP Mailing Form – Send Email from Flash Using PHP

by Hiroshi on June 13, 2008

in Flash & PHP, Mail

In this PHP tutorial we will learn that how to send email from flash using PHP.

You will need:

Flash file
PHP email script
Webhost to check the script

Creating Flash File

Create a movie clip and give it name i.e. form

In that movie clip take single lined input text fields and give them name in Var: box. Take comments input text field and it must be multiple lined.

Place this action at form movie clip

onClipEvent (data)
{
_root.nextFrame();
}

And at submit button place this action

on (release)
{
form.loadVariables("email.php", "POST");
}

In next frame take a back button and apply this action at that

on (release)
{
prevFrame();
}

At the first frame where the form is, place stop action.

Creating PHP File

<?php
 
// request variables
$email=$_REQUEST["email"];
$name=$_REQUEST["name"];
$company=$_REQUEST["company"];
$phone=$_REQUEST["phone"];
$comments=$_REQUEST["comments"];
$subject=$_REQUEST["subject"];
 
$myfrom = $email;
$myemail = "youemail@hotmail.com";
$todayis = date("l, F j, Y, g:i a") ;
$subject= "Message From Website";
$message = "
Date : $todayis
Name: : $name
company: : $company
phone: : $phone
email: : $email
comments : $comments
";
$from = "From: $myfrom\r\n";
mail($myemail, $subject, $message, $from);
$subject2="Thanks for contacting me.";
$message2="Dear $name,
Thanks for contacting me, I will respond you shortly.";
$from2 = "From: $myemail\r\n";
mail($email, $subject2, $message2, $from2);
?>

Download Complete Script Example

Related Posts

Previous post:

Next post: