I’ve been getting an ‘undefined’ response and no email sent upon sending. It USED to work but then I added a few fields and broke it somehow. I copied everything perfectly, and know my text field var’s are named correctly, so the fault lies somewhere here. Please help!
’submit’ button actionscript:
on (release) {
status.text = ""; //clearing status field for this attempt
if(formValidationChecks()){ //calls function and validate form inputs
//creating two LoadVars objects, to send and receive values (see flash help)
my_lv = new LoadVars();
result_lv = new LoadVars();
//filling first object with form values
my_lv.from = from.text;
my_lv.phone = phone.text;
my_lv.company = company.text;
my_lv.email = email.text;
my_lv.quote = quote.text;
my_lv.project = project.text;
my_lv.budget = budget.text;
my_lv.message = message.text;
my_lv.hear = hear.text;
//tracing out to make sure right values are sent
trace(my_lv.from + " " + my_lv.phone + " " + my_lv.company + " " + my_lv.email + " " + my_lv.quote + " " + my_lv.project + " " + my_lv.budget + " " + my_lv.hear + " " + my_lv.message);
//line that sends variables to mail.php file (severFile variable)
my_lv.sendAndLoad(serverFile, result_lv, "POST");
//event which is called when result_lv passed above, receives response from php page
result_lv.onLoad = function(success:Boolean) {
if (success) {
from.text = phone.text = company.text = email.text = quote.text = project.text = budget.text = message.text = hear.text = " "; //clearing all fields
}
status.text = result_lv ["serverResponse"]; //entering response to status field for display
}; //end of onLoad event
}
}//end of button event
–
*my mail php:
<?php
//receiving variables from Flash, through REQUEST object, and storing them in local php variables
$from = $_REQUEST["from"];
$phone = $_REQUEST["phone"];
$company = $_REQUEST["company"];
$email = $_REQUEST["email"];
$quote = $_REQUEST["quote"];
$project = $_REQUEST["project"];
$budget = $_REQUEST["budget"];
$message = $_REQUEST["message"];
$hear = $_REQUEST["hear"];
//filling information for email to be sent
$to = stephenjames@gmail.com .; //destination email - stephenjames@gmail.com
$subject = "Alder: Contact Us"; //email subject
$full_msg = "Name: " . $from . "
Phone: " . $phone . "
Company: " . $company . "
Email: " . $email . "
Quote: " . $quote . "
Project: " . $project . "
Approx Budget: " . $budget . "
Message: " . $message . "
How did you hear about us?: " . $hear . " ; //email body
//line that actually sends an email
$ok= mail($to, $subject, $full_msg);
//based on results of mail function, sending failure or success message back to Flash
if($ok) {
echo("&serverResponse=The mail was successfully sent");
} else {
echo("&serverResponse=Sorry but the email could not be sent. Please try again!");
}
?>
Thanks so much :hugegrin: