Ultrashock Forums > Flash > Data Communication
Flash/PHP Email Form HELP

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
Flash/PHP Email Form HELP
Old 2009-01-20 Last edited by toofastdad : 2009-01-20 at 14:14.

I have an email form that works. Then I added 2 more fields. When testing my email it is missing the 2 new fields. Can anyone help me with this, I'm hopeless with PHP. I need this rectified ASAP

The 2 fields that don't get sent with the email are:

Company and Name


Thanks... Colin

See attached code.

FLASH

//EMBED DYNAMIC FONTS
company_txt.embedFonts = true;
name_txt.embedFonts = true;
title_txt.embedFonts = true;
email_txt.embedFonts = true;
phone_txt.embedFonts = true;
message_txt.embedFonts = true;

//INITIAL TEXT IN TEXT BOXES
company_txt.text = "";
name_txt.text = "";
title_txt.text = "";
email_txt.text = "";
phone_txt.text = "";
message_txt.text = "";
status_txt.text = "";

//TABS
company_txt.tabIndex = 0;
name_txt.tabIndex = 1;
title_txt.tabIndex = 2;
email_txt.tabIndex = 3;
phone_txt.tabIndex = 4;
message_txt.tabIndex = 5;
send_mc.tabIndex = 6;
clear_mc.tabIndex = 7;


//ASTERICKS TO MARK WHAT NEEDS TO BE CORRECTED
companyBlank_mc._visible = false;
nameBlank_mc._visible = false;
titleBlank_mc._visible = false;
emailBlank_mc._visible = false;
phoneBlank_mc._visible = false;
messageBlank_mc._visible = false;

//LOADVARS
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();

//SEND ON RELEASE FUNCTION
send_mc.onRelease = function():Void {
//HIDE ASTERICKS IN BEGINNING
companyBlank_mc._visible = false;
nameBlank_mc._visible = false;
titleBlank_mc._visible = false;
emailBlank_mc._visible = false;
phoneBlank_mc._visible = false;
messageBlank_mc._visible = false;
//SET STATUS TO BLANK
status_txt.text = "";
//LOAD TEXT FOR SENDERLOAD
senderLoad.company_txt = company_txt.text;
senderLoad.name_txt = name_txt.text;
senderLoad.title_txt = title_txt.text;
senderLoad.email_txt = email_txt.text;
senderLoad.phone_txt = phone_txt.text;
senderLoad.message_txt = message_txt.text;
//IF ANY TEXT FIELD IS BLANK OF INCORRECT, RETURN A FALSE
if (company_txt.text == "") {
companyBlank_mc._visible = true;
status_txt.text = "Company is Required";
} else if (name_txt.text == "") {
nameBlank_mc._visible = true;
status_txt.text = "Name is Required";
} else if (title_txt.text == "") {
titleBlank_mc._visible = true;
status_txt.text = "Title is Required";
} else if (email_txt.text == "") {
emailBlank_mc._visible = true;
status_txt.text = "Email is Required";
//IF EMAIL IS INVALID RETURN A FALSE (CODE FOR EMAIL
//EMAIL VALIDATION IS LOCATED BELOW
} else if (email_txt.text.emailValidation() == false) {
emailBlank_mc._visible = true;
status_txt.text = "Email is Invalid";
} else if (phone_txt.text == "") {
phoneBlank_mc._visible = true;
status_txt.text = "Phone is Required";
} else if (message_txt.text == "") {
messageBlank_mc._visible = true;
status_txt.text = "Message is Required";
} else {
//IF ALL TEXT FIELDS ARE VALID, THEN SEND AND LOAD CONTACT.PHP
senderLoad.sendAndLoad("contact.php",receiveLoad);
}
};

//FUNCTION TO CHECK IF FORM IS SENT
receiveLoad.onLoad = function():Void {
if (this.sentOk) {
company_txt.text = "";
name_txt.text = "";
title_txt.text = "";
email_txt.text = "";
phone_txt.text = "";
message_txt.text = "";
status_txt.text = "Message Sent. Thank You!";
} else {
status_txt.text = "Error Sending Message.";
}
};

//CLEAR BUTTON
clear_mc.onRelease = function():Void {
company_txt.text = "";
name_txt.text = "";
title_txt.text = "";
email_txt.text = "";
phone_txt.text = "";
message_txt.text = "";
status_txt.text = "";
companyBlank_mc._visible = false;
nameBlank_mc._visible = false;
titleBlank_mc._visible = false;
emailBlank_mc._visible = false;
phoneBlank_mc._visible = false;
messageBlank_mc._visible = false;
};

//EMAIL VALIDATION
String.prototype.emailValidation = function() {
//check to see if atleast 5 characters
if (this.length<5) {
return false;
}
//Check to see if there are illegal characters within the email
invalidChars = "`!#$%^&*()[]{}|:;'\",<>";
for (i=0; i<this.length; i++) {
if (invalidChars.indexOf(this.charAt(i)) != -1) {
return false;
}
}
//Check to see if the symbol @ is present, and
//if its in a valid postition
at = this.lastIndexOf("@");
if (at<1 || (at == this.length-1)) {
return false;
}
//Check to see if a period is present and if
//its in a valid position
period = this.lastIndexOf(".");
if (period<4 || (period == this.length-1)) {
return false;
}
//Check to see if the @ symbol and period are
//within their valid positions.
if (1>=period-at) {
return false;
}
//Check to see if there are no two periods or
//@ symbols in a row
for (i=0; i<this.length; i++) {
if ((this.charAt(i) == "." || this.charAt(i) == "@") && this.charAt(i) == this.charAt(i-1)) {
return false;
}
}
return true;
};

//BUTTONS

//ON ROLLOVER
clear_mc.onRollOver = function() {
clear_mc.gotoAndStop("over");
};
send_mc.onRollOver = function() {
send_mc.gotoAndStop("over");
};

www_mc.onRollOver = function() {
www_mc.gotoAndStop("over");
};

//ON ROLLOUT
clear_mc.onRollOut = function() {
clear_mc.gotoAndStop("out");
};
send_mc.onRollOut = function() {
send_mc.gotoAndStop("out");
};
www_mc.onRollOut = function() {
www_mc.gotoAndStop("out");
};

www_mc.onPress = function() {
getURL("http://www.MYSITE.com/","_self");
www_mc.gotoAndStop("out");

};


PHP

<?PHP
$to = "MYNAME@MYSITE.com";
$subject = "QUESTIONAIRE";
$e = $_POST['email_txt'];
$message = "Company: " . $_POST['company_txt'];
$message = "\nName: " . $_POST['name_txt'];
$message = "\nTitle: " . $_POST['title_txt'];
$message .= "\nE-mail: " . $e;
$message .= "\nPhone: " . $_POST['phone_txt'];
$message .= "\n\nMessage: " . $_POST['message_txt'];
$headers = "From: $e";
$headers .= "\nReply-To: $e";
$sentOk = mail($to,$subject,$message,$headers);
echo "sentOk=" . $sentOk;
echo(date_default_timezone_set("America/Halifax"));
?>
Colin
postbit arrow Be the first to comment! | 972 views postbit arrow Reply: with Quote   
Registered User
toofastdad is offline
seperator
Posts: 20
2005-12-01
seperator
Thread Tools
Display Modes Rate This Thread
Rate This Thread: