# PHP Flash Form-Mail Tutorial

**URL:** https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694
**Category:** flash
**Created:** [March 17, 2003, 6:38am UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694 "2003-03-17T06:38:38Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Lacuna](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@Lacuna](https://forum.kirupa.com/u/Lacuna)
#### Post date: [March 17, 2003, 6:38am UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/1 "2003-03-17T06:38:38Z")

</div>

I have experienced the pain of trying to find out HOW TO MAKE A MAILFORM in flash so once i figured it

out I thought I’d share it with you all.

1). Open a new file and have _one layer with two keyframes_

2). Put a stop() action in each of them buy \*right-clicking on the keyframe, selecting actions and

choosing ‘stop()’ from the basic actions list\*

3). Now drag and drop all the text sections that you want into the first keyframe. Make sure that the

text fields that you expect the user to fill in are changed to _input text_ found in the

properties box.

4). Create 2 buttons. Call one send and the other clear.

5). Still in keyframe 1 put the variable in each ‘input text’ selection. NOT THE INSTANCE NAME!! If it

is a name that you are getting, make it easy and type ‘name’ (without the quotes) in the VARIABLE box

in the property section. (you might have name/phone/email/comment)

6). Click on the ‘clear’ button and put the following in the ‘actions’ section

```php

on (release) {
name = "";
phone ="";
email ="";
comment ="";
} 

```

This tells the variables to clear if the button is pressed.

7). Then click on the ‘send’ button and put the following in the code:

```php

on (release) {
if (name eq "" or phone eq "" or email eq "" or comment eq "") {
stop ();
} else {
loadVariablesNum ("form.php", 0, "POST");
gotoAndStop (2);
}
} 

```

This will make sure all fields are filled out before the user can click send. If you dont need certain

areas filled out then just remove it from the code. Erase from the ‘or’ to the “” . Then you’ll notice

that it tells it to send the information to ‘form.php’. We will make that now.

8).Open notepad and enter

```php

<?PHP
$to = "you@yourdomain.com";
$msg = "$name

";
$msg .= "$phone

"; 
$msg .= "$email

"; 
$msg .= "$comment

"; 
mail($to, $subject, $msg, "From: My web site
Reply-To: $email
");
?> 

```

Replace the email with your own and then add all of the variables you’ve used. When you use multiple

variables you have to use “.=” as shown above in the code. The  
is just like a br in html.

It starts a new line. Make sure to have the ; as they show there is more code to come.

9).Now save this file as form.php (You’ll have to type in the extension or it will just save as txt.

10). Go to keyframe 2 and enter whatever confirmation text you want the user to see upon submiting his request.

1. Upload the .swf and the .php to your server and there you are…a mailing form ready for your

visitors.

Happy Mailing All.

:love:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 17, 2003, 3:16pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/2 "2003-03-17T15:16:22Z")

</div>

Make sure you use the $\_POST[]; array to catch the variables. That script won’t work on some hosts if they have global variables turned off. Check out my post in the BEST oF KIRUPA section and read Senocular’s posts to see what I mean.

\*\*You beat me to it, I had a tutorial for this coming out too. 😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 7:42am UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/3 "2003-03-18T07:42:49Z")

</div>

i followed the tutorial, but it wont mail to my address?  
i tried to follow you jubba on the php thing but alas in your tutorials for flash/php i didnt see the to e-mail address?

in this tutorial

\<?PHP  
$to = “me@mydomain”;  
$msg = "$name

";  
$msg .= "$email

";  
$msg .= "$company

";  
$msg .= "$comment

";  
mail($to, $subject, $msg, "From: my domain  
Reply-To: $email  
");  
?\>

that’s what i have in my php file? am i missin somthn’. and i do think it has to do w/ the $\_POST[] command.

hope this makes sense to help me complete this wonderful tutorial!  
thanx  
jayemsee!  
++++++++++++++++  
im enclosing my version of it, it’s too big but i wanted to get it to work first before refining.!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 7:57am UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/4 "2003-03-18T07:57:23Z")

</div>

i tried it again? this time w/ $\_POST. but i still dont think i know what im doin?  
please when you can try to help out on the sending PHP part?  
thanx again  
jayemsee  
[www.jayemsee.com](http://www.jayemsee.com)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 4:23pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/5 "2003-03-18T16:23:23Z")

</div>

check out this post as well, it might help. I included the source files at the bottom of the posts too.

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=17604](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=17604)

its the second post.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 5:36pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/6 "2003-03-18T17:36:51Z")

</div>

jubba … i can’t make your file work. i d/l’d the zip file and put the contents on my server. it doesn’t do anything when i press the send button. I guess i will go read through all the posts on this subject and see if i can figure it out.

i already have a php mail form on my server in html but it would be nice to be able to incorporate one into my flash movie.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 5:43pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/7 "2003-03-18T17:43:33Z")

</div>

so i would make this my form.php that flash loads as a variable?

\<?

// Recieving and Creating Variables…  
$Name = $\_POST[‘name’];  
$Email = $\_POST[‘email’];  
$Message = $\_POST[‘message’];  
$Subject = “Test E-mail Tutorial”;  
$Header = “From: $Name \<$Email\>”;

//Performing Mail script…  
mail($Email, $Subject, $Message, $Header);

?\>

my questions are? where is the area i put in my e-mail address so it comes to me?  
and lets say i have name, e-mail, company, comment???  
i tried you example but it dosent work? unless im an absolute php-tard, which probobally isnt that far off anyway.

i have the send button in flash calling for

```php

on (release) {
if (name eq "" or phone eq "" or email eq "" or comment eq "") {
stop ();
} else {
loadVariablesNum ("form.php", 0, "POST");
gotoAndStop (2);
}
}

```

thanx

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 6:05pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/8 "2003-03-18T18:05:37Z")

</div>

i made it work  
[http://www.aaronsleeper.com/num2/PHPMailTest.fla](http://www.aaronsleeper.com/num2/PHPMailTest.fla)  
[http://www.aaronsleeper.com/num2/form.php](http://www.aaronsleeper.com/num2/form.php)

it sends it to me … so you can change the variables as needed

thanks very much for your help everyone.

i’m going to go animate it now and make it all purdy for my site =)

* * *

jayemsee

```php

$to = "PUT YOUR EMAIL BETWEEN THESE QUOTES";
$msg = "$name

";
$msg .= "$email

"; 
$msg .= "$company

"; 
$msg .= "$comment

"; 
mail($to, $subject, $msg, "From: my domain
Reply-To: $email
");
?>

```

=)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 6:41pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/9 "2003-03-18T18:41:41Z")

</div>

hmmmph

it was working … i put it in the fla for my site and now it’s not working … what’s up with that

[http://www.aaronsleeper.com/site.fla](http://www.aaronsleeper.com/site.fla)  
[http://www.aaronsleeper.com/form.php](http://www.aaronsleeper.com/form.php)

the mail form is in \_root.window.content.mailform

i haven’t done any animation and hardly any editing to the original script … so i’m not sure what’s wrong ☹

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 7:56pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/10 "2003-03-18T19:56:15Z")

</div>

Im lost now man.

See if you make a tutorial make sure you go over it and make it work yourself and show an example.

Please re do it or somthing

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 8:06pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/11 "2003-03-18T20:06:01Z")

</div>

your clear fields dont work either FYI, stupid php! i mean i animated it and everything but, it calls the .php but wont send?  
o well well see  
jayemsee

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 8:09pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/12 "2003-03-18T20:09:21Z")

</div>

OK here is my source just that now i cant upload to my site the \*\*\*\*!!! hosting out but here si the source check it out to see if the code look aight

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 8:17pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/13 "2003-03-18T20:17:18Z")

</div>

jayemsee:  
they just stopped working … weird … i’ve been able to clear the fields this whole time … it’s simple enough. i’m not sure why they’re not working.

now i’m just having a lot of trouble. this is frustrating

i switched PHP scripts … i’m now using a piece of the script that runs the HTML version of my mailer on my site it is as follows:

```php

<?
$msg = "E-mail sent from www.aaronsleeper.com

";

$msg .= "From Name: ".$_POST["name"]."
";
$msg .= "From E-Mail: ".$_POST["email"]."
";
$msg .= "Telephone: ".$_POST["phone"]."

";
$msg .= "Subject: ".$_POST["subject"]."

";
$msg .= "Message: ".$_POST["message"]."

";

$to = "me@aaronsleeper.com";
$subject = "aaronsleeper.com - ".$_POST["subject"];

$mailheaders .= "Reply-To: ".$_POST["email"]."

";

$result = mail($to, $subject, $msg, $mailheaders);
?> 

```

BullDog\_Flash:  
I looked at your files and everything looks right according to the tutorial. You should make sure though that the server to which you’re uploading your files supports PHP. some servers don’t

Jubba:  
Lostinbeta:  
Ilyalmasse:  
Senocular:  
Sbeener:  
Anyone!!!:  
please help us figure these out

my files are located at:  
[http://www.aaronsleeper.com/form.php](http://www.aaronsleeper.com/form.php)  
[http://www.aaronsleeper.com/site.fla](http://www.aaronsleeper.com/site.fla)

thanks =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 8:24pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/14 "2003-03-18T20:24:27Z")

</div>

alright now i figured out why my clear button wasn’t working

i had to specify the path to the variables from the root so in the part of the script that tells the fields to = “”; i had to put the path in front of it \_root.window.content.mailform.fieldName = “” ;

so i then applied the same principle elsewhere in the mailform and it works … it sends mail BUT it doesn’t seem to send the variables as specified in the PHP … it just sends the text specified there and sends the mail … but nothing the user types … goes with it ☹

help  
files are still in the same location as the previous post

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 8:40pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/15 "2003-03-18T20:40:29Z")

</div>

Shuga yes my hosting does support PHP but its not wokring yet

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 11:03pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/16 "2003-03-18T23:03:08Z")

</div>

you have to define the $\_POST[];

I don’t think you can just do

```php
$_POST['email];

```

you have to do

```php

$email = $_POST['email'];

```

and then put $email whereever you need that varable…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 11:05pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/17 "2003-03-18T23:05:40Z")

</div>

oh, and bulldog. Her tutorial works for her. When people begin to modify things start to not work.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 11:21pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/18 "2003-03-18T23:21:48Z")

</div>

i dont even have any of those issues, lol mine just plain and simply wont send! not a thing! anyway-  
i tried lookin into .asp, and lookin up tutorials on PHP but they just give the dynamics, and other email php scripts, dont use this  
$\_POST command were all tryin to figure out?  
anyway i’ll keep checkin back, im pretty sure some one on this site uses php to communicate to php from flash! if so PLEASE HELP!  
thanx jayemsee

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 11:32pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/19 "2003-03-18T23:32:28Z")

</div>

Jubba could you tell me some hosting with P{HP support so i can try it all out or somone telkl me please

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 18, 2003, 11:45pm UTC](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694/20 "2003-03-18T23:45:01Z")

</div>

Ok, I’m going to look thru your posts now and try to help. Bulldog, the only free host that supports PHP is [http://www.tripod.lycos.co.uk/](http://www.tripod.lycos.co.uk/)

i’ll post back in a few minutes because I have some time now. Waiting for a response from a client.

[Next page](https://forum.kirupa.com/t/php-flash-form-mail-tutorial/15694.md?page=2)
