Submit simple flash email form using PHP

In this article I will explain you how to make a simple email form in flash and submitting with PHP. First we have to create a flash form. Create the input boxes in flash and enter the instance name.

Sending the flash email form using PHP
Sending the flash email form using PHP

You can view demo and download the example file below.

Download FileDemo

Download the example file and extract. You can modify flash file using its .FLA source.Below is the Flash action script for the flash form.

stop();
System.useCodepage = true;
sendmail.onRelease = function() {
	form_varbls = new LoadVars();
	form_varbls.email = email.text;
	form_varbls.namess = namess.text;
	form_varbls.subject = subject.text;
	form_varbls.message = message.text;
	if (form_varbls.email != "" and form_varbls.subject != "" and form_varbls.namess !="" and form_varbls.message != "") {
		form_varbls.sendAndLoad("sendmail.php", form_varbls, "POST");
		gotoAndStop(2);
	} else {
		error_clip.gotoAndPlay(2);
	}
	form_varbls.onLoad = function() {
		gotoAndStop(3);
	};
};

Above flash script will capture the values from flash input boxes and post it to PHP using POST method. The PHP mail function will be like below.

sendmail.php

$name=$_POST['namess'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
//set the email id below
$to="info@webinfopedia.com";
$subject="Sending flash form using PHP";
     // To send HTML mail, the Content-type header must be set
        $headers  = 'MIME-Version: 1.0' . "
";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
		
	// Additional headers
	$headers .= 'To: Info ' . "
";
	$headers .= 'From: '.$_POST['namess'].' <'.$_POST['email'].'>' . "
";
	mail($to,$subject,$message,$headers);

PHP will get values by using POST method. This is the simple form submission using Flash and PHP. We can also use this system to insert the form data to database like a registration form.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>