# \[Flash 8\] Need help with actionscript for flash contact form

**URL:** <https://forum.kirupa.com/t/flash-8-need-help-with-actionscript-for-flash-contact-form/317578>\
**Category:** flash\
**Created:** [December 25, 2010, 10:39am UTC](https://forum.kirupa.com/t/flash-8-need-help-with-actionscript-for-flash-contact-form/317578 "2010-12-25T10:39:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cavaliere123](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@cavaliere123](https://forum.kirupa.com/u/cavaliere123)\
**Post date:** [December 25, 2010, 10:39am UTC](https://forum.kirupa.com/t/flash-8-need-help-with-actionscript-for-flash-contact-form/317578/1 "2010-12-25T10:39:04Z")

</div>

As title states, I’m creating a flash contact form and so far I’ve been able to get everything working except the check boxes. I can’t get the user input for them to be sent to my e-mail, but all the text fields are sent to my e-mail without any problems. Any help would be greatly appreciated. Here’s my code:

**Actionscript:**

error.\_alpha = 0;  
sending.\_alpha = 0;  
submit.onRelease = function() {  
var my\_lv:LoadVars = new LoadVars();  
var scnr:String;  
var scnb:String;  
var swgd:String;  
var sother:String;  
var semail2:String;  
var sphone2:String;  
var sany:String;

```
scnr = "na";
scnb = "na";
swgd = "na";
sother = "na";
semail2 = "na";
sphone2 = "na";
sany = "na";

```

var checkListener:Object = new Object();  
checkListener.click = function() {  
if (cnr.selected) {  
scnr = “Selected”;  
}  
if (cnb.selected) {  
scnb = “Selected”;  
}  
if (wgd.selected) {  
swgd = “Selected”;  
}  
if (other.selected) {  
sother = “Selected”;  
}  
if (email2.selected) {  
semail2 = “Selected”;  
}  
if (phone2.selected) {  
sphone2 = “Selected”;  
}  
if (any.selected) {  
sany = “Selected”;  
}  
};

cnr.addEventListener(“click”, checkListener);  
cnb.addEventListener(“click”, checkListener);  
wgd.addEventListener(“click”, checkListener);  
other.addEventListener(“click”, checkListener);  
email2.addEventListener(“click”, checkListener);  
phone2.addEventListener(“click”, checkListener);  
any.addEventListener(“click”, checkListener);

```
my_lv.fullname = fullname.text;
my_lv.businessname = businessname.text;
my_lv.email = email.text;
my_lv.phone = phone.text;
my_lv.time = time.text;
my_lv.date = date.text;
my_lv.comments = comments.text;

if (fullname.text != "" && businessname.text != "" && email.text != "" && phone.text != "" && time.text != "" && date.text != "" && comments.text != "")
{
my_lv.sendAndLoad("mail.php",my_lv,"POST");
sending._alpha = 100;
}
else
{
error._alpha = 100;
}
my_lv.onLoad = function () {
gotoAndStop("Success");

```

}  
}  
fullname.onSetFocus = businessname.onSetFocus = email.onSetFocus = phone.onSetFocus = time.onSetFocus = date.onSetFocus = comments.onSetFocus = cnr.onSetFocus = cnb.onSetFocus = wgd.onSetFocus = other.onSetFocus = email2.onSetFocus = phone2.onSetFocus = any.onSetFocus = function () {  
if (error.\_alpha != 0) {  
error.\_alpha = 0;  
}  
}

**PHP:**

\<?php

```
//receiving variables from Flash, through REQUEST object, and storing them in local php variables
$fullname = $_REQUEST["fullname"];
$businessname = $_REQUEST["businessname"];
$email = $_REQUEST["email"];
$phone = $_REQUEST["phone"];
$time = $_REQUEST["time"];
$date = $_REQUEST["date"];
$comments = stripslashes($_REQUEST['comments']);
$ip = $_SERVER['REMOTE_ADDR'];
$v1 = " ";
$v2 = " ";
$v3 = " ";
$v4 = " ";
$v5 = " ";
$v6 = " ";
$v7 = " ";

if($_REQUEST['scnr']=="Selected"){
    $v1 = "Computer & Network Repair";
}
if($_REQUEST['scnb']=="Selected"){
    $v2 = "Computer & Network Build";
}
if($_REQUEST['swgd']=="Selected"){
    $v3 = "Web & Graphic Design";
}
if($_REQUEST['sother']=="Selected"){
    $v4 = "Other";
}

if($_REQUEST['semail2']=="Selected"){
    $v5 = "E-mail";
}
if($_REQUEST['sphone2']=="Selected"){
    $v6 = "Phone";
}
if($_REQUEST['sany']=="Selected"){
    $v7 = "Any";
}

//filling information for email to be sent
$to = "chadbush@berserkit.com"; //destination email
$subject = "Contact Form from BerserkIT.com"; //email subject

$body = "From: $fullname

```

";  
$body .="Business: $businessname  
";  
$body .="E-mail: $email  
";  
$body .="Phone: $phone  
";  
$body .="Time: $time  
";  
$body .="Date: $date  
";  
$body .="IP: $ip  
";  
$body .="Desired Services:  
“;  
$body .=”$v1  
“;  
$body .=”$v2  
“;  
$body .=”$v3  
“;  
$body .=”$v4  
";  
$body .="Desired Form of Contact:  
“;  
$body .=”$v5  
“;  
$body .=”$v6  
“;  
$body .=”$v7  
";  
$body .=“Comments:  
“;  
$body .=”$comments”;

```
//line that sends an email
mail($to, $subject, $body);

```

?\>
