OurTown
10-08-2007, 06:59 PM
I am creating an e-mail form to place a classified ad. After the user inputs their information they click next to confirm all their data. Everything transfers fine from the first frame to the 2nd. The issue is that when they go to send nothing gets sent, and I don't have anything appear in my status_txt box. If I don't include a name or something like that it appears in the box. I sent variables to my php file through the URL, but it won't do it through flash. I've tried using both Post and Get for PHP. I've included my AS and PHP code below.
AS
category_txt.text+= "The category is ["+list1+"]\n";
var email_lv:LoadVars = new LoadVars();
email_lv.onLoad = function(success) {
if (success) {
if (email_lv.server_mes =="ok") {
Status = "Ad Sent";
}
} else {
Status = "error submitting ad";
}
};
submit_btn.onRelease = function() {
if (!names.length) {
Status = "Please enter your name";
} else if (!email.length) {
Status = "Please enter your email address";
} else if (!phone.length) {
Status = "Please enter your phone number";
} else if (!street.length) {
Status = "Please enter your street address";
} else if (!city.length) {
Status = "Please enter your city";
} else if (!states.length) {
Status = "Please enter your state";
} else if (!zip.length) {
Status = "Please enter your zip code";
} else if (!category.length) {
Status = "Please enter the category name or enter N/A";
} else if (!description_txt.length) {
Status = "Please enter the ad description";
} else {
email_lv.names_txt = names_txt.text;
email_lv.street_txt= street_txt.text;
email_lv.city_txt = city_txt.text;
email_lv.states_txt = states_txt.text;
email_lv.zip_txt = zip_txt.text;
email_lv.phone_txt = phone_txt.text;
email_lv.email_txt = email_txt.text;
email_lv.category_txt = category_txt.text;
email_lv.description_txt = "Description"
email_lv.sendAndLoad("classifiedform2.php", email_lv, "Post");
}
};
PHP
<?php
/* recipients */
$recipient .= "webmaster@xxxxxx.com,$email_txt";
/* I removed my e-mail for posting. This isn't the error */
/* subject */
$subject = "Classified Ad From Website";
/* message */
$message .= "Name: $names_txt
Email: $email_txt
Phone Number: $phone_txt
Street Address: $street_txt
City: $city_txt
State: $states_txt
Zip: $zip_txt
Category: $category_txt
description: $description_txt";
/* additional header pieces for errors, From cc's, bcc's, etc */
$headers .= "From: $names_txt <$email_txt>";
/* and now mail it */
$confirmation = mail($recipient, $subject, $message, $headers);
if($confirmation){
echo "&server_mes=ok&";
}else{
echo "&server_mes=fail&";
}
?>
AS
category_txt.text+= "The category is ["+list1+"]\n";
var email_lv:LoadVars = new LoadVars();
email_lv.onLoad = function(success) {
if (success) {
if (email_lv.server_mes =="ok") {
Status = "Ad Sent";
}
} else {
Status = "error submitting ad";
}
};
submit_btn.onRelease = function() {
if (!names.length) {
Status = "Please enter your name";
} else if (!email.length) {
Status = "Please enter your email address";
} else if (!phone.length) {
Status = "Please enter your phone number";
} else if (!street.length) {
Status = "Please enter your street address";
} else if (!city.length) {
Status = "Please enter your city";
} else if (!states.length) {
Status = "Please enter your state";
} else if (!zip.length) {
Status = "Please enter your zip code";
} else if (!category.length) {
Status = "Please enter the category name or enter N/A";
} else if (!description_txt.length) {
Status = "Please enter the ad description";
} else {
email_lv.names_txt = names_txt.text;
email_lv.street_txt= street_txt.text;
email_lv.city_txt = city_txt.text;
email_lv.states_txt = states_txt.text;
email_lv.zip_txt = zip_txt.text;
email_lv.phone_txt = phone_txt.text;
email_lv.email_txt = email_txt.text;
email_lv.category_txt = category_txt.text;
email_lv.description_txt = "Description"
email_lv.sendAndLoad("classifiedform2.php", email_lv, "Post");
}
};
PHP
<?php
/* recipients */
$recipient .= "webmaster@xxxxxx.com,$email_txt";
/* I removed my e-mail for posting. This isn't the error */
/* subject */
$subject = "Classified Ad From Website";
/* message */
$message .= "Name: $names_txt
Email: $email_txt
Phone Number: $phone_txt
Street Address: $street_txt
City: $city_txt
State: $states_txt
Zip: $zip_txt
Category: $category_txt
description: $description_txt";
/* additional header pieces for errors, From cc's, bcc's, etc */
$headers .= "From: $names_txt <$email_txt>";
/* and now mail it */
$confirmation = mail($recipient, $subject, $message, $headers);
if($confirmation){
echo "&server_mes=ok&";
}else{
echo "&server_mes=fail&";
}
?>