Can anyone help me figure out how to add a second message box to the code below.
This is a Flash contact form that uses PHP to send an email. The form works fine, but I’ve been trying to figure out the code to add a SECOND message to my email.
Currently when I run and fill out the form, I get the email, subject and message, but I want to add a second message field, let’s call it message2.
Here is the Flash and PHP code:
//////------Flash AS 2.0------------////////
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);
}
};
//////------PHP code------------////////
<?php
// read the variables form the string, (this is not needed with some servers).
$subject = $_REQUEST[“subject”];
$message = $_REQUEST[“message”];
$sender = $_REQUEST[“sender”];
// include sender IP in the message.
$full_message = $_SERVER[‘REMOTE_ADDR’] . "
" . $message;
$message= $full_message;
// remove the backslashes that normally appears when entering " or ’
$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 = “web visitor:”.’ '.$subject;
// send the email, make sure you replace email@yourserver.com with your email address
if(isset($message) and isset($subject) and isset($sender)){
mail("you@yourdomain.com", $subject, $message, “From: $sender”);
}
?>