roscov
%Europe/Berlin %399 %2010, 10:34
Hallo allemaal,
Ik heb een formulier gemaakt in een flyout banner die de gegevens verstuurd via PHP.
Nu kan ik alles netjes versturen alleen de waarden die ik aangeef in de Radio Buttons word niet meeverstuurd.
Ik krijg in de mail:
Game: undefined
Heb al veel fora's doorzocht maar nog geen oplossing gevonden. Wel iets met eventlister maar weet niet hoe ik deze in de code moet zetten...
Hier de AS en PHP
stop();
mc_goBack._visible = false;
mc_Submit.enabled = true;
//Tab Ordering Condes
tf_Name.tabIndex = 1;//First Tab
tf_VorName.tabIndex = 2;
tf_Email.tabIndex = 3;
// Warning Default text
tf_warn.text = "All the fields are mandatory.";
// Load vars
var sentData:LoadVars = new LoadVars();
var reciveData:LoadVars = new LoadVars();
// Object for passing field bg
var objectBg:MovieClip;
// To validate the form
var mailOK:Boolean = false;
// Name Field Focus
tf_Name.onSetFocus = applyFunction(this, onFocus, mc_NameBg);
tf_Name.onKillFocus = applyFunction(this, killFocus, mc_NameBg);
// VorName Field Focus
tf_VorName.onSetFocus = applyFunction(this, onFocus, mc_VorNameBg);
tf_VorName.onKillFocus = applyFunction(this, killFocus, mc_VorNameBg);
// Email Field Focus
tf_Email.onSetFocus = applyFunction(this, onFocus, mc_EmailBg);
tf_Email.onKillFocus = applyFunction(this, killFocus, mc_EmailBg);
// On Focus function
function onFocus(objectBg:MovieClip):Void {
tf_warn.text = "All the fields are mandatory.";
objectBg.gotoAndStop("fn_Focus");
}
// On Kill Focus Function
function killFocus(objectBg:MovieClip):Void {
objectBg.gotoAndStop("fn_Normal");
}
mc_Submit._focusrect = false;
mc_Reset._focusrect = false;
// On Form submit
mc_Submit.onRelease = submitForm;
// On Reset form
mc_Reset.onRelease = resetForm;
function submitForm():Void {
Selection.setFocus(mc_Submit);
// Validating email
indexOfAt = tf_Email.text.indexOf("@");
lastIndexOfDot = tf_Email.text.lastIndexOf(".");
if (indexOfAt != -1 && lastIndexOfDot != -1) {
if (lastIndexOfDot<indexOfAt) {
} else {
mc_EmailBg.gotoAndStop("fn_Normal");
mailOK = true;
}
} else {
mc_EmailBg.gotoAndStop("fn_Error");
mailOK = false;
}
// Validating name
if (tf_Name.text == "") {
mc_NameBg.gotoAndStop("fn_Error");
mailOK = false;
}
// Validating name
if (tf_VorName.text == "") {
mc_VorNameBg.gotoAndStop("fn_Error");
mailOK = false;
}
// Sending mail once the data validate
if (mailOK) {
mc_Submit.enabled = false;
//Data from Radiogroup Game
sentData.game = Game.text;
sentData.name = tf_Name.text;
sentData.vorname = tf_VorName.text;
sentData.email = tf_Email.text;
sentData.sendAndLoad("mailer.php",reciveData);
} else {
tf_warn.text = "Please fill out all the field highlighted in RED correctly.";
}
}
reciveData.onLoad = function() {
//trace(this.mailSentSuccess);
if (this.mailSentSuccess) {
gotoAndStop("fn_Success");
mc_goBack._visible = true;
} else {
gotoAndStop("fn_Failed");
mc_goBack._visible = true;
}
};
// Reset Form
function resetForm():Void {
tf_Name.text = tf_Email.text=tf_VorName.text="";
Selection.setFocus(tf_Name);
mc_EmailBg.gotoAndStop("fn_Normal");
mc_VorNameBg.gotoAndStop("fn_Normal");
mc_NameBg.gotoAndStop("fn_Normal");
}
// Button modes
mc_Submit.onRollOver = applyFunction(this, onRollOverButton, mc_Submit);
mc_Submit.onRollOut = applyFunction(this, onRollOutButton, mc_Submit);
mc_Submit.onReleaseOutside = applyFunction(this, onRollOutButton, mc_Submit);
mc_Reset.onRollOver = applyFunction(this, onRollOverButton, mc_Reset);
mc_Reset.onRollOut = applyFunction(this, onRollOutButton, mc_Reset);
mc_Reset.onReleaseOutside = applyFunction(this, onRollOutButton, mc_Reset);
function onRollOverButton(buttonObj) {
buttonObj.gotoAndStop("fn_Focus");
}
function onRollOutButton(buttonObj) {
buttonObj.gotoAndStop("fn_Normal");
}
// Go Back Button
mc_goBack.onRollOver = applyFunction(this, onRollOverButton, mc_goBack);
mc_goBack.onRollOut = applyFunction(this, onRollOutButton, mc_goBack);
mc_goBack.onReleaseOutside = applyFunction(this, onRollOutButton, mc_goBack);
mc_goBack.onRelease = function() {
gotoAndStop("fn_Form");
};
function applyFunction(functionObject:Object, functionName:Function) {
var functionArguments:Array = arguments.slice(2);
var returnFunction:Function = function () {
functionName.apply(functionObject,functionArgument s);
};
return returnFunction;
}
En de PHP File:
<?php
// read the variables form the string,
// Sending email to . Replace email address with your email address.
$to = "r.leegwater@roscov.nl";
// Name information from the form
$name = $_REQUEST["name"];
$vorname = $_REQUEST["vorname"];
$game = $_REQUEST["game"];
// Getting IP Address
$getIP = $_SERVER['REMOTE_ADDR'];
// Message information from the form
$getMessage = $_REQUEST["msg"];
// Concnating the valuses
$message = "Game: ".$game."\n\nName: ".$name."\nVorname: ".$vorname."\n\nMessage Sent from IP:".$getIP;
// Sender email information from the form
$sender = "From:". $_REQUEST["email"];
// 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 = "Contact Form: Game FFF";
if(isset($message) and isset($subject) and isset($sender)){
$mailSentSuccess = mail($to, $subject, $message, $sender);
echo "mailSentSuccess=".$mailSentSuccess;
}
// Send thank you mail
if($mailSentSuccess == true)
{
$thanksMessage = "Thank you ".$vorname ." for Contacting us.\nVery Sortly we will get in touch with you.\n\nKind Regards,\Your Name";
$thanksSubject = "Thank you for Contacting us!";
$thanksMessage = stripslashes($thanksMessage);
$thanksSubject = stripslashes($thanksSubject);
$thanksSender = "From:".$to;
$thanksSender = stripslashes($thanksSender);
$thanksTo = $_REQUEST["email"];
mail($thanksTo, $thanksSubject, $thanksMessage, $thanksSender);
}
?>
Ik heb de .fla ook meegestuurd.
Kan iemand mij helpen?
Alvast bedankt.
Mvg Rogier leegwater
Ik heb een formulier gemaakt in een flyout banner die de gegevens verstuurd via PHP.
Nu kan ik alles netjes versturen alleen de waarden die ik aangeef in de Radio Buttons word niet meeverstuurd.
Ik krijg in de mail:
Game: undefined
Heb al veel fora's doorzocht maar nog geen oplossing gevonden. Wel iets met eventlister maar weet niet hoe ik deze in de code moet zetten...
Hier de AS en PHP
stop();
mc_goBack._visible = false;
mc_Submit.enabled = true;
//Tab Ordering Condes
tf_Name.tabIndex = 1;//First Tab
tf_VorName.tabIndex = 2;
tf_Email.tabIndex = 3;
// Warning Default text
tf_warn.text = "All the fields are mandatory.";
// Load vars
var sentData:LoadVars = new LoadVars();
var reciveData:LoadVars = new LoadVars();
// Object for passing field bg
var objectBg:MovieClip;
// To validate the form
var mailOK:Boolean = false;
// Name Field Focus
tf_Name.onSetFocus = applyFunction(this, onFocus, mc_NameBg);
tf_Name.onKillFocus = applyFunction(this, killFocus, mc_NameBg);
// VorName Field Focus
tf_VorName.onSetFocus = applyFunction(this, onFocus, mc_VorNameBg);
tf_VorName.onKillFocus = applyFunction(this, killFocus, mc_VorNameBg);
// Email Field Focus
tf_Email.onSetFocus = applyFunction(this, onFocus, mc_EmailBg);
tf_Email.onKillFocus = applyFunction(this, killFocus, mc_EmailBg);
// On Focus function
function onFocus(objectBg:MovieClip):Void {
tf_warn.text = "All the fields are mandatory.";
objectBg.gotoAndStop("fn_Focus");
}
// On Kill Focus Function
function killFocus(objectBg:MovieClip):Void {
objectBg.gotoAndStop("fn_Normal");
}
mc_Submit._focusrect = false;
mc_Reset._focusrect = false;
// On Form submit
mc_Submit.onRelease = submitForm;
// On Reset form
mc_Reset.onRelease = resetForm;
function submitForm():Void {
Selection.setFocus(mc_Submit);
// Validating email
indexOfAt = tf_Email.text.indexOf("@");
lastIndexOfDot = tf_Email.text.lastIndexOf(".");
if (indexOfAt != -1 && lastIndexOfDot != -1) {
if (lastIndexOfDot<indexOfAt) {
} else {
mc_EmailBg.gotoAndStop("fn_Normal");
mailOK = true;
}
} else {
mc_EmailBg.gotoAndStop("fn_Error");
mailOK = false;
}
// Validating name
if (tf_Name.text == "") {
mc_NameBg.gotoAndStop("fn_Error");
mailOK = false;
}
// Validating name
if (tf_VorName.text == "") {
mc_VorNameBg.gotoAndStop("fn_Error");
mailOK = false;
}
// Sending mail once the data validate
if (mailOK) {
mc_Submit.enabled = false;
//Data from Radiogroup Game
sentData.game = Game.text;
sentData.name = tf_Name.text;
sentData.vorname = tf_VorName.text;
sentData.email = tf_Email.text;
sentData.sendAndLoad("mailer.php",reciveData);
} else {
tf_warn.text = "Please fill out all the field highlighted in RED correctly.";
}
}
reciveData.onLoad = function() {
//trace(this.mailSentSuccess);
if (this.mailSentSuccess) {
gotoAndStop("fn_Success");
mc_goBack._visible = true;
} else {
gotoAndStop("fn_Failed");
mc_goBack._visible = true;
}
};
// Reset Form
function resetForm():Void {
tf_Name.text = tf_Email.text=tf_VorName.text="";
Selection.setFocus(tf_Name);
mc_EmailBg.gotoAndStop("fn_Normal");
mc_VorNameBg.gotoAndStop("fn_Normal");
mc_NameBg.gotoAndStop("fn_Normal");
}
// Button modes
mc_Submit.onRollOver = applyFunction(this, onRollOverButton, mc_Submit);
mc_Submit.onRollOut = applyFunction(this, onRollOutButton, mc_Submit);
mc_Submit.onReleaseOutside = applyFunction(this, onRollOutButton, mc_Submit);
mc_Reset.onRollOver = applyFunction(this, onRollOverButton, mc_Reset);
mc_Reset.onRollOut = applyFunction(this, onRollOutButton, mc_Reset);
mc_Reset.onReleaseOutside = applyFunction(this, onRollOutButton, mc_Reset);
function onRollOverButton(buttonObj) {
buttonObj.gotoAndStop("fn_Focus");
}
function onRollOutButton(buttonObj) {
buttonObj.gotoAndStop("fn_Normal");
}
// Go Back Button
mc_goBack.onRollOver = applyFunction(this, onRollOverButton, mc_goBack);
mc_goBack.onRollOut = applyFunction(this, onRollOutButton, mc_goBack);
mc_goBack.onReleaseOutside = applyFunction(this, onRollOutButton, mc_goBack);
mc_goBack.onRelease = function() {
gotoAndStop("fn_Form");
};
function applyFunction(functionObject:Object, functionName:Function) {
var functionArguments:Array = arguments.slice(2);
var returnFunction:Function = function () {
functionName.apply(functionObject,functionArgument s);
};
return returnFunction;
}
En de PHP File:
<?php
// read the variables form the string,
// Sending email to . Replace email address with your email address.
$to = "r.leegwater@roscov.nl";
// Name information from the form
$name = $_REQUEST["name"];
$vorname = $_REQUEST["vorname"];
$game = $_REQUEST["game"];
// Getting IP Address
$getIP = $_SERVER['REMOTE_ADDR'];
// Message information from the form
$getMessage = $_REQUEST["msg"];
// Concnating the valuses
$message = "Game: ".$game."\n\nName: ".$name."\nVorname: ".$vorname."\n\nMessage Sent from IP:".$getIP;
// Sender email information from the form
$sender = "From:". $_REQUEST["email"];
// 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 = "Contact Form: Game FFF";
if(isset($message) and isset($subject) and isset($sender)){
$mailSentSuccess = mail($to, $subject, $message, $sender);
echo "mailSentSuccess=".$mailSentSuccess;
}
// Send thank you mail
if($mailSentSuccess == true)
{
$thanksMessage = "Thank you ".$vorname ." for Contacting us.\nVery Sortly we will get in touch with you.\n\nKind Regards,\Your Name";
$thanksSubject = "Thank you for Contacting us!";
$thanksMessage = stripslashes($thanksMessage);
$thanksSubject = stripslashes($thanksSubject);
$thanksSender = "From:".$to;
$thanksSender = stripslashes($thanksSender);
$thanksTo = $_REQUEST["email"];
mail($thanksTo, $thanksSubject, $thanksMessage, $thanksSender);
}
?>
Ik heb de .fla ook meegestuurd.
Kan iemand mij helpen?
Alvast bedankt.
Mvg Rogier leegwater