# Send mail with flash and PHP problem

**URL:** <https://forum.kirupa.com/t/send-mail-with-flash-and-php-problem/156787>\
**Category:** Uncategorized\
**Created:** [July 28, 2005, 12:53am UTC](https://forum.kirupa.com/t/send-mail-with-flash-and-php-problem/156787 "2005-07-28T00:53:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaDeViL](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@DaDeViL](https://forum.kirupa.com/u/DaDeViL)\
**Post date:** [July 28, 2005, 12:53am UTC](https://forum.kirupa.com/t/send-mail-with-flash-and-php-problem/156787/1 "2005-07-28T00:53:35Z")

</div>

I am currently in the process of pulling out my hair. I have no idea why this code does not work.  
I create loadVars to send to a PHP script that in turn sends an email to me with the variable values. The PHP works because when i go to the url that it points to, it sends me a blank email, so i think the actionscript is the problem since i get NO emails when i try to use the contact form.

THanks

Here is the code:

```auto

on (release) {
	if (_parent.form.name eq "") {
		_parent.form.errors = "You forgot to fill in your name!";
	} else if (_parent.form.company eq "") {
		_parent.form.errors = "You forgot to fill in your company name!";
	} else if (_parent.form.email eq "") {
		_parent.form.errors = "You forgot to fill in your e-mail address!";
	} else if (_parent.form.phone eq "") {
		_parent.form.errors = "You forgot to fill in your phone number!";
	} else {
 
		mail_vars = new LoadVars();
		mail_vars.name = _parent.form.name;
		mail_vars.company = _parent.form.company;
		mail_vars.email = _parent.form.phone;
		mail_vars.comments = _parent.form.comments;
		
		mail_vars.onLoad = function(success) {
			if (success) {
				_parent.form.errors = "Sent! Thank You!";
				// done with contact form..make this point somewhere
			} else {
				_parent.form.errors = "error with contact form";
			}
		};

		mail_vars.sendAndLoad("http://www.testsite.com/contact.php", mail_vars, "POST");
	}
}

```

and the php

```php

	$name= $_POST['name'];
	$company= $_POST['company'];
	$email= $_POST['email'];
	$phone= $_POST['phone'];
	$comments= $_POST['comments'];
	
	echo $name;
	
	$message = '
'.$name .'
'. $company .'
'. $email .'
' .$phone. '
---------------------
'. $comments .'
';

	mail("email@email.com", "POSSIBLE CLIENT!", $message, "From: email@{$_SERVER['SERVER_NAME']}");

	echo "Sent!";

```
