PDA

View Full Version : E-mail issue


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&";
}
?>

OurTown
10-09-2007, 03:00 PM
I fixed the problem. For some reason the submit button wasn't sending the information. I placed the script in the status_btn AS. I also set it to have the status_txt to state "Please wait for confirmation" when initially pressed. It's funny I spend half a day on this yesterday then I fix it this morning in 30 min.

on(release){
status_txt.text = "Please wait for confirmation..."
reply_lv = new LoadVars();
reply_lv.onLoad = function(success) {
if (success) {
if (reply_lv.server_mes = "ok") {
status_txt.text = "Ad Sent";
}
} else {
status_txt.text = "Error submitting ad";
}
};
myVars = new LoadVars();
myVars.street = street_txt.text;
myVars.names = names_txt.text;
myVars.city = city_txt.text;
myVars.states = states_txt.text;
myVars.zip = zip_txt.text;
myVars.phone = phone_txt.text;
myVars.email = email_txt.text;
myVars.category = category_txt.text
myVars.description = description_txt.text
myVars.sendAndLoad("classifiedform2.php", reply_lv, "POST")
}