This tutorial will hopefully teach you how to make a basic contact page/e-mail form in flash and php :)What you will need: Flash (duh!) Notepad A working e-mail ;) Somewhere to host the files
To start with, we need to set up the basic form itself, so open up flash. Firstly you will need to put a blank text box on the stage, in this write "your name" or "name" or something along those lines. Next you need to put another text box next to that, this should remain empty, make sure the empty text box is selected, then enter the following properties: Now do the same thing for "email" (change the Var to email) and "message" (change the Var to message and change "single line" to "multiline").At the bottom of the form, add a button that says "send" and a blank dynamic text box on the left of it and give it the properties as follows: Select only the "name", "email" and "message" text boxes, right click them and select "convert to symbol" select "movieclip" and give it the name "contact form".Now select the send button, right click and select "convert to symbol", select "movieclip" and give it the name of "sendbutton", now single-click the button and open up the properties, give it the instance name of "sendbutton".Now for the code :)Select the frame that has all the objects in and open up the Actions layer, in the actions layer, enter the following code: sendmessage.onRelease = function(){ mailform.loadVariables("sendemail.php", "POST"); messagebox.text = "Message Sent"; mailform.name = ""; mailform.email = ""; mailform.message = ""; } save this file as "contact" and export it as an swf. Now the PHP part, the part that will actually send our e-mail to the email address you specify.Open up notepad or dreamweaver (in dreamweaver create a new php document, and delete everythign int here already). Now enter the following php code: <?php
$sendTo = "YOUR E-MAIL"; $subject = "ENTER TITLE HERE"; $headers = "From: " . $_POST["name"] . "<" . $_POST["email"] .">
"; $headers .= "Reply-To: " . $_POST["email"] . "
"; $headers .= "Return-path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?> obviously change "YOUR E-MAIL" to your own e-mail.
 and there you have your own email form in flash :)
Source1 - 4768contactform.fla (right-click > "save target as" to download)
Source2 - 4768contactform.swf (right-click > "save target as" to download)
Source3 - 4768sendemail.php (right-click > "save target as" to download)
Back to tutorials
Sponsored Link
|