# \[as2 cs4\]Need help with an flash contact form

**URL:** <https://forum.kirupa.com/t/as2-cs4-need-help-with-an-flash-contact-form/294725>\
**Category:** flash\
**Created:** [August 19, 2009, 5:30am UTC](https://forum.kirupa.com/t/as2-cs4-need-help-with-an-flash-contact-form/294725 "2009-08-19T05:30:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ensomniak](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@Ensomniak](https://forum.kirupa.com/u/Ensomniak)\
**Post date:** [August 19, 2009, 5:30am UTC](https://forum.kirupa.com/t/as2-cs4-need-help-with-an-flash-contact-form/294725/1 "2009-08-19T05:30:30Z")

</div>

I hope this is the best section to put this question in as this form also uses php. I am somewhat of a novice with both AS2 and PHP, but I’ve been trying. I suppose I’d need someone to check both my php information and my as2 information. I’m going to list my action script that I used originally and the php I’m using. I changed the action script and added a bunch of stuff, thinking that it would help, but it hasn’t. My problem isn’t getting it to work, it’s adding extra information that I want sent in the email (such as “company”, “best time to contact” etc.). Anyway, I hope I can find some assistance here. Thank you in advance.

Original AS:  
stop();  
send\_btn.onRelease = function() {  
my\_vars = new LoadVars();  
my\_vars.sender = email\_box.text;  
my\_vars.subject = subject\_box.text;  
my\_vars.message = message\_box.text;  
if (my\_vars.sender != “” and my\_vars.subject != “” and my\_vars.message != “”) {  
my\_vars.sendAndLoad(“mailer.php”, my\_vars, “POST”);  
gotoAndStop(2);  
} else {  
error\_clip.gotoAndPlay(2);  
}  
my\_vars.onLoad = function() {  
gotoAndStop(3);  
};  
};  
email\_box.onSetFocus = subject\_box.onSetFocus=message\_box.onSetFocus=function () {  
if (error\_clip.\_currentframe != 1) {  
error\_clip.gotoAndPlay(6);  
}  
};

The PHP I’m using (which I edited in hopes that it was correct) is:  
\<?php

// read the variables form the string, (this is not needed with some servers).  
$subject = $\_POST[“subject”];  
$event = $\_POST[“event”];  
$message = $\_POST[“message”];  
$sender = $\_POST[“sender”];  
$company = $\_POST[“company”];  
$time = $\_POST[“time”];  
$phone = $\_POST[“phone”];  
$email = $\_POST[“email”];  
$guests = $\_POST[“guests”];

// remove the backslashes that normally appears when entering " or ’  
$event = stripslashes($event);  
$message = stripslashes($message);  
$subject = stripslashes($subject);  
$sender = stripslashes($sender);

// add a prefix in the subject line so that you know the email was sent by online form  
$subject = "Order from “. $subject;  
$message = “”.$subject.”

Company: “.$company.”

Phone Number: ".$phone.  
"

Event Type: “.$event.”

Number Of Guests: ".$guests.  
"

Best Time To Contact: “.$time.”

Message: ".$message;

$myEmail = "nyte@darkfyre-ent.com";

// send the email, make sure you replace [email@yourserver.com](mailto:email@yourserver.com) with your email address  
if(isset($message) and isset($subject) and isset($sender)){  
mail($myEmail, $subject, $message, “From: $sender”);  
}  
?\>

Thanks again. E.
