# Flash Form through PHP

**URL:** https://forum.kirupa.com/t/flash-form-through-php/184874
**Category:** flash
**Created:** [April 8, 2006, 6:15pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874 "2006-04-08T18:15:54Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 8, 2006, 6:15pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/1 "2006-04-08T18:15:54Z")

</div>

I am creating a flash form using PHP by following this tutorial…

[http://www.kirupa.com/developer/actionscript/flash\_php\_email.htm](http://www.kirupa.com/developer/actionscript/flash_php_email.htm)

I want few more things…in the body of the mail like phone, address. Please tell me what changes in PHP file will allow me to do this?

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 9, 2006, 12:05am UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/2 "2006-04-09T00:05:00Z")

</div>

please help guys…tell me the changes required at add more fields.

---

<div class="post-metadata">

### Author: ![bootiteq](https://avatars.discourse-cdn.com/v4/letter/b/eb9ed0/32.png) [@bootiteq](https://forum.kirupa.com/u/bootiteq)
#### Post date: [April 9, 2006, 6:07am UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/3 "2006-04-09T06:07:46Z")

</div>

```php
$headers .= "Phone: " . $_POST["phone"] . "
";
$headers .= "Address: " . $_POST["address"] . "
";

```

a break down^

. is the same as + in ActionScript

$\_POST is the variable name the script is expecting.

"  
" basically returns the line and starts a new line ( same effect as \<br\> )

make sure you enter “phone” and “address” into the var area of your respective dynamic text boxes

hope this helps…

:yoshi:

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 9, 2006, 11:02am UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/4 "2006-04-09T11:02:54Z")

</div>

I add those lines in PHP and also add var name in flash file…but still forwarding only a message. Please check…

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 10, 2006, 7:53pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/5 "2006-04-10T19:53:32Z")

</div>

Please someone can help…

---

<div class="post-metadata">

### Author: ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)
#### Post date: [April 10, 2006, 8:25pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/6 "2006-04-10T20:25:21Z")

</div>

show the as code & php code you are using and also what values do you have on your contact form other than messages?

> [@ashras99](#):
>
> Please someone can help…

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 10, 2006, 10:06pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/7 "2006-04-10T22:06:18Z")

</div>

This is the PHP code…in which i have added Phone and Company variable.

```php
<?php
/ *************************************************** \
 * PHP 4.1.0+ version of email script. For more
 * information on the mail() function for PHP, see
 * http://www.php.net/manual/en/function.mail.php
\ *************************************************** /

// First, set up some variables to serve you in
// getting an email. This includes the email this is
// sent to (yours) and what the subject of this email
// should be. It's a good idea to choose your own
// subject instead of allowing the user to. This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "xyz@abc.com";
$subject = "Mail from me";

// variables are sent to this PHP page through
// the POST method. $_POST is a global associative array
// of variables passed through this method. From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.

// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">
";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "
";
// often email servers won't allow emails to be sent to
// domains other than their own. The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$headers .= "Phone: " . $_POST["phone"] . "
"; 
$headers .= "Company: " . $_POST["company"] . "
"; 
$message = $_POST["message"];

// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

?>

```

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 10, 2006, 10:08pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/8 "2006-04-10T22:08:06Z")

</div>

And i like to mention a problem again…that only mailing a message. And i need Phone, company, and name/email too if possible in the message body.

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 11, 2006, 5:46pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/9 "2006-04-11T17:46:06Z")

</div>

Well someone will reply to my problem…i need urgent help.

---

<div class="post-metadata">

### Author: ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)
#### Post date: [April 11, 2006, 5:50pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/10 "2006-04-11T17:50:59Z")

</div>

```php
<?php 
/ *************************************************** \ 
* PHP 4.1.0+ version of email script. For more 
* information on the mail() function for PHP, see 
* http://www.php.net/manual/en/function.mail.php 
\ *************************************************** / 

// First, set up some variables to serve you in 
// getting an email. This includes the email this is 
// sent to (yours) and what the subject of this email 
// should be. It's a good idea to choose your own 
// subject instead of allowing the user to. This will 
// help prevent spam filters from snatching this email 
// out from under your nose when something unusual is put. 

$sendTo = "xyz@abc.com"; 
$subject = "Mail from me"; 

// variables are sent to this PHP page through 
// the POST method. $_POST is a global associative array 
// of variables passed through this method. From that, we 
// can get the values sent to this page from Flash and 
// assign them to appropriate variables which can be used 
// in the PHP mail() function. 

// header information not including sendTo and Subject 
// these all go in one variable. First, include From: 
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">
"; 
// next include a replyto 
$headers .= "Reply-To: " . $_POST["email"] . "
"; 
// often email servers won't allow emails to be sent to 
// domains other than their own. The return path here will 
// often lift that restriction so, for instance, you could send 
// email to a hotmail account. (hosting provider settings may vary) 
// technically bounced email is supposed to go to the return-path email 
$headers .= "Return-path: " . $_POST["email"]; 

// now we can add the content of the message to a body variable 
$headers .= "Phone: " . $_POST["phone"] . "
"; 
$headers .= "Company: " . $_POST["company"] . "
"; 
$message = "Phone: ".$_POST['phone']."/r Company: ".$_POST['company']."/r".$_POST["message"]; 

// once the variables have been defined, they can be included 
// in the mail function call which will send you an email 
mail($sendTo, $subject, $message, $headers); 

?>

```

---

<div class="post-metadata">

### Author: ![ashras99](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashras99](https://forum.kirupa.com/u/ashras99)
#### Post date: [April 11, 2006, 10:47pm UTC](https://forum.kirupa.com/t/flash-form-through-php/184874/11 "2006-04-11T22:47:40Z")

</div>

Thanks this is working…

Please tell me one more thing…

\*\*If I want to clear a form textboxes in the movieclip…by clicking clear button…then what will be the code. I tried…

\_root.mc1.text = “”\*\*

but this not works.
