I'm having some trouble with this code, not sure if I need a Flash expert though. I grabbed a tutorial from
This is to show you how to add a form to a Flash site that allows visitors to email you.
Ive tried the sample files on my hosting and it works fine. However if I add the code to my flash site with an additional $name field, but it doesn't work. Perhaps a PHP expert can spot my mistake?
The ActionScript______________
stop();
System.useCodepage = true;
send_btn.onRelease = function() {
my_vars = new LoadVars();
my_vars.sender = email_box.text;
my_vars.name = name_box.text;
my_vars.subject = subject_box.text;
my_vars.message = message_box.text;
if (my_vars.sender != "" and my_vars.name != "" 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 = name_box.onSetFocus=subject_box.onSetFocus=message_box.onSetFocus=function () { if (error_clip._currentframe != 1) {error_clip.gotoAndPlay(6);}
};;
The php___________________
<?php
/* ---------------------------
php and flash contact form.
by ---------------------------
Note: most servers require that one of the emails (sender or receiver) to be an email hosted by same server,
so make sure your email (on last line of this file) is one hosted on same server.
--------------------------- */
// read the variables form the string, (this is not needed with some servers).
$subject = $_REQUEST["subject"];
$name = $_REQUEST["name"];
$message = $_REQUEST["message"];
$sender = $_REQUEST["sender"];
// include sender IP in the message.
$full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message;
$message= $full_message;
// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message);
$subject = stripslashes($subject);
$name = stripslashes($name);
$sender = stripslashes($sender);
// add a prefix in the subject line so that you know the email was sent by online form
$subject = "Contact form ". $subject;
// send the email, make sure you replace email@yourserver.com with your email address
if(isset($message) and isset($subject) isset($name) and isset($sender)){
mail("fizzak2@mydomain.com", $subject, $name, $message, "From: $sender");
}
?>
This is to show you how to add a form to a Flash site that allows visitors to email you.
Ive tried the sample files on my hosting and it works fine. However if I add the code to my flash site with an additional $name field, but it doesn't work. Perhaps a PHP expert can spot my mistake?
The ActionScript______________
stop();
System.useCodepage = true;
send_btn.onRelease = function() {
my_vars = new LoadVars();
my_vars.sender = email_box.text;
my_vars.name = name_box.text;
my_vars.subject = subject_box.text;
my_vars.message = message_box.text;
if (my_vars.sender != "" and my_vars.name != "" 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 = name_box.onSetFocus=subject_box.onSetFocus=message_box.onSetFocus=function () { if (error_clip._currentframe != 1) {error_clip.gotoAndPlay(6);}
};;
The php___________________
<?php
/* ---------------------------
php and flash contact form.
by ---------------------------
Note: most servers require that one of the emails (sender or receiver) to be an email hosted by same server,
so make sure your email (on last line of this file) is one hosted on same server.
--------------------------- */
// read the variables form the string, (this is not needed with some servers).
$subject = $_REQUEST["subject"];
$name = $_REQUEST["name"];
$message = $_REQUEST["message"];
$sender = $_REQUEST["sender"];
// include sender IP in the message.
$full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message;
$message= $full_message;
// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message);
$subject = stripslashes($subject);
$name = stripslashes($name);
$sender = stripslashes($sender);
// add a prefix in the subject line so that you know the email was sent by online form
$subject = "Contact form ". $subject;
// send the email, make sure you replace email@yourserver.com with your email address
if(isset($message) and isset($subject) isset($name) and isset($sender)){
mail("fizzak2@mydomain.com", $subject, $name, $message, "From: $sender");
}
?>