# Form with components..works but with errors

**URL:** <https://forum.kirupa.com/t/form-with-components-works-but-with-errors/168642>\
**Category:** Uncategorized\
**Created:** [November 8, 2005, 11:41pm UTC](https://forum.kirupa.com/t/form-with-components-works-but-with-errors/168642 "2005-11-08T23:41:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fruityDJ](https://avatars.discourse-cdn.com/v4/letter/f/46a35a/32.png) [@fruityDJ](https://forum.kirupa.com/u/fruityDJ)\
**Post date:** [November 8, 2005, 11:41pm UTC](https://forum.kirupa.com/t/form-with-components-works-but-with-errors/168642/1 "2005-11-08T23:41:50Z")

</div>

i have created this form by using just components.

here is my actionscript:

frame 1

```auto
stop();

resetBtn.onRelease=function(){
      onReset();
}

submitBtn.onRelease=function(){
      onSubmit();
}

function onReset() {
	male.selected = false;
	female.selected = false;
	country.text = "";
    age.setSelectedIndex(0);
	urname.text = "";
	email.text = "";
}
function onSubmit() {
    formData = new LoadVars();	
	
	formData.urname = "";
	formData.email = "";
	formData.age = "";
	formData.gender = "";
	formData.country = "";
	
    formData.urname = urname.getValue();
	formData.email = email.getValue();
    formData.age = age.getValue();
    formData.gender = genderGroup.getValue();
	formData.country = country.getValue();
    formData.send("mailform.php", "POST");
	gotoAndStop(2);
}

```

frame 2

```auto
stop();

```

on frame 2 its just a message saying “mail sent”

php script:

```php
<?php

$sendTo = "my_email_here";
$subject = "My new form";

$headers = "From: <" . $_POST["email"] .">
";
$headers .= "Reply-To: " . $_POST["email"] . "
";
$headers .= "Return-path: " . $_POST["email"];

$message = $_POST["urname"];
$message .= "
";
$message .= "Country : $country
";
$message .= "Age : $age
";
$message .= "Gender : $gender
";

mail($sendTo, $subject, $message, $headers);

?>

```

ok.  
Problem 1:  
When i click the Submit button another browser window open with the php. file (even though the form still send the data…HOW to stop the form opening the php. file in a browser window ???  
Problem 2:  
When i get the email on the “From” i get “undefined@servername.here” (servername\* is my host server)  
the subject comes correctly  
then on the body i DONT get the “country” and “name”…like this:

```auto
undefined
Country : undefined
Age : 15-18
Gender : male

```

here is my swf:  
[ui\_form.swf](http://www.ervald.com/jule/csspage/ui_form.swf)
