Form
- Lghtning4u
- Born


- Joined: Dec 09, 2007
- Posts: 4
- Loc: La Porte, Texas
- Status: Offline
I know this can't be this hard but can anyone tell me why my contact form will not work? What am I missing here?
Actionscript
php
Actionscript
Code: [ Select ]
onClipEvent (load) {
var contact_php_file = "flashEmailer.php";
send_btn.onRelease = function() {
checkForm();
}
function validateEmail(address) {
// Check address length
if(address.length >= 7) {
// Check for an @ sign
if(address.indexOf("@") > 0) {
// Check for at least 2 characters following the @
if((address.indexOf("@") + 2)<address.lastIndexOf(".")) {
// Check for a domain name of at least 2 characters
if (address.lastIndexOf(".") < (address.length - 2)) {
// If all the above tests pass, the email address is in valid format
return true;
}
}
}
}
// Called if the email fails
trace("The entered email address is invalid.");
return false;
}
function checkForm() {
n = form.name_txt.text;
e = form.email_txt.text;
m = form.msg_txt.text;
if(m != "" && e != "" && validateEmail(e)) {
sendEmail(n, e, m);
} else {
trace("All Required Fields Not Filled In!");
}
}
function sendEmail(n, e, m) {
session = "?nocache=" + random(999999);
contact_lv = new LoadVars();
contact_lv.name = n;
contact_lv.email = e;
contact_lv.message = m;
contact_lv.key = "email";
trace(n + " - " + e + " - " + m);
contact_lv.sendAndLoad(contact_php_file + session, contact_lv, "POST");
contact_lv.onLoad = function(success) {
if(!success) {
return trace("Error calling PHP File!");
} else {
return trace("Email Sent!");
}
}
}
stop();
}
var contact_php_file = "flashEmailer.php";
send_btn.onRelease = function() {
checkForm();
}
function validateEmail(address) {
// Check address length
if(address.length >= 7) {
// Check for an @ sign
if(address.indexOf("@") > 0) {
// Check for at least 2 characters following the @
if((address.indexOf("@") + 2)<address.lastIndexOf(".")) {
// Check for a domain name of at least 2 characters
if (address.lastIndexOf(".") < (address.length - 2)) {
// If all the above tests pass, the email address is in valid format
return true;
}
}
}
}
// Called if the email fails
trace("The entered email address is invalid.");
return false;
}
function checkForm() {
n = form.name_txt.text;
e = form.email_txt.text;
m = form.msg_txt.text;
if(m != "" && e != "" && validateEmail(e)) {
sendEmail(n, e, m);
} else {
trace("All Required Fields Not Filled In!");
}
}
function sendEmail(n, e, m) {
session = "?nocache=" + random(999999);
contact_lv = new LoadVars();
contact_lv.name = n;
contact_lv.email = e;
contact_lv.message = m;
contact_lv.key = "email";
trace(n + " - " + e + " - " + m);
contact_lv.sendAndLoad(contact_php_file + session, contact_lv, "POST");
contact_lv.onLoad = function(success) {
if(!success) {
return trace("Error calling PHP File!");
} else {
return trace("Email Sent!");
}
}
}
stop();
}
- onClipEvent (load) {
- var contact_php_file = "flashEmailer.php";
- send_btn.onRelease = function() {
- checkForm();
- }
- function validateEmail(address) {
- // Check address length
- if(address.length >= 7) {
- // Check for an @ sign
- if(address.indexOf("@") > 0) {
- // Check for at least 2 characters following the @
- if((address.indexOf("@") + 2)<address.lastIndexOf(".")) {
- // Check for a domain name of at least 2 characters
- if (address.lastIndexOf(".") < (address.length - 2)) {
- // If all the above tests pass, the email address is in valid format
- return true;
- }
- }
- }
- }
- // Called if the email fails
- trace("The entered email address is invalid.");
- return false;
- }
- function checkForm() {
- n = form.name_txt.text;
- e = form.email_txt.text;
- m = form.msg_txt.text;
- if(m != "" && e != "" && validateEmail(e)) {
- sendEmail(n, e, m);
- } else {
- trace("All Required Fields Not Filled In!");
- }
- }
- function sendEmail(n, e, m) {
- session = "?nocache=" + random(999999);
- contact_lv = new LoadVars();
- contact_lv.name = n;
- contact_lv.email = e;
- contact_lv.message = m;
- contact_lv.key = "email";
- trace(n + " - " + e + " - " + m);
- contact_lv.sendAndLoad(contact_php_file + session, contact_lv, "POST");
- contact_lv.onLoad = function(success) {
- if(!success) {
- return trace("Error calling PHP File!");
- } else {
- return trace("Email Sent!");
- }
- }
- }
- stop();
- }
php
Code: [ Select ]
<?php
$recipients = "customerservice@mydomain.com" . ",";
$subject = "The Message";
// Grab the key from Flash to ensure security
$sendKey = $_POST['key'];
// Only allow the page to send if Flash is the requester
if($sendKey == "email") {
// The following three variables are gathered from Flash
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// Grab todays date
$date = date("F j, Y", time());
// This block is the actual message that is sent in the email
$email_info .= "this message has been sent you your from your e-broucher.\n\n";
$email_info .= "-----------------------------------------\n";
$email_info .= "Name: " . $name . "\n";
$email_info .= "Email: " . $email . "\n";
$email_info .= "Date Sent: " . $date . "\n\n";
$email_info .= "Message\n";
$email_info .= "-----------------------------------------\n";
$email_info .= "" . $message . "\n";
$mailheaders = "From: customerservice@mydomain.com <> \n";
$mailheaders .= "Reply-To: " . $email . "\n\n";
if(mail($recipients, $subject, $email_info, $mailheaders)) {
// Print a success for Flash to know the email is being sent
print "&success=true";
}
}
?>
$recipients = "customerservice@mydomain.com" . ",";
$subject = "The Message";
// Grab the key from Flash to ensure security
$sendKey = $_POST['key'];
// Only allow the page to send if Flash is the requester
if($sendKey == "email") {
// The following three variables are gathered from Flash
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// Grab todays date
$date = date("F j, Y", time());
// This block is the actual message that is sent in the email
$email_info .= "this message has been sent you your from your e-broucher.\n\n";
$email_info .= "-----------------------------------------\n";
$email_info .= "Name: " . $name . "\n";
$email_info .= "Email: " . $email . "\n";
$email_info .= "Date Sent: " . $date . "\n\n";
$email_info .= "Message\n";
$email_info .= "-----------------------------------------\n";
$email_info .= "" . $message . "\n";
$mailheaders = "From: customerservice@mydomain.com <> \n";
$mailheaders .= "Reply-To: " . $email . "\n\n";
if(mail($recipients, $subject, $email_info, $mailheaders)) {
// Print a success for Flash to know the email is being sent
print "&success=true";
}
}
?>
- <?php
- $recipients = "customerservice@mydomain.com" . ",";
- $subject = "The Message";
- // Grab the key from Flash to ensure security
- $sendKey = $_POST['key'];
- // Only allow the page to send if Flash is the requester
- if($sendKey == "email") {
- // The following three variables are gathered from Flash
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- // Grab todays date
- $date = date("F j, Y", time());
- // This block is the actual message that is sent in the email
- $email_info .= "this message has been sent you your from your e-broucher.\n\n";
- $email_info .= "-----------------------------------------\n";
- $email_info .= "Name: " . $name . "\n";
- $email_info .= "Email: " . $email . "\n";
- $email_info .= "Date Sent: " . $date . "\n\n";
- $email_info .= "Message\n";
- $email_info .= "-----------------------------------------\n";
- $email_info .= "" . $message . "\n";
- $mailheaders = "From: customerservice@mydomain.com <> \n";
- $mailheaders .= "Reply-To: " . $email . "\n\n";
- if(mail($recipients, $subject, $email_info, $mailheaders)) {
- // Print a success for Flash to know the email is being sent
- print "&success=true";
- }
- }
- ?>
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
January 29th, 2008, 8:10 pm
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 2 posts
- Users browsing this forum: No registered users and 50 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum

