Hello,

I have created a flash form and I am trying to figure out what mistake I have made in my code as it is not sending the data. Here is my action script and php code below...Can any one help me identify the error and/or how to fix it?

stop();

TEMPty_mc._visible = false;
fielderror_mc._visible = false;

t=this;
tfArray = ['name','email','phone','comments'];

submitBtn.onPress = function() {
entry=true;
sendLV = new LoadVars();
for (var i = 0; i<tfArray.length; i++) {
//check fields for entry
if(t[tfArray[i]].text.length<1) {
entry=false;
break;
}
sendLV[tfArray[i]] = t[tfArray[i]].text;
}

sendLV.catalogVia = cstate;
if(entry) {
//send email request **CHANGE THIS PHP ADDRESS**
sendLV.sendAndLoad('http://www.1031america.com/email.php',receiveLV,'_POST');
}else{
//display error message
fieldError();
}
};

receiveLV = new LoadVars();
receiveLV.onLoad = function() {
//do whatever: message sent successfully (thank you + info page or something)
TEMPty_mc._visible = true;
//in this case I've turned off all the text fields and the buttons
for(var i=0;i<tfArray.length;i++) {
t[tfArray[i]]._visible = false;
}
submitBtn.enabled=false;
email_btn.enabled = false;
rmail_btn.enabled = false;
};


//display error message handling
var fielderror_id:Number;

function fieldError() {
submitBtn._visible = false;
submitBtn.enabled = false;
fielderror_mc._visible = true;
clearInterval(fielderror_id);
fielderror_id=setInterval(this, "time", 3000);
}

function time() {
clearInterval(fielderror_id);
fielderror_mc._visible = false;
submitBtn._visible = true;
submitBtn.enabled = true;
}




PHP code...


<?php
//include("yourClientsConnection.php");

//the 'from' email address should be changed to match the requirements of your client's server (usually one of the client's server email addresses)
$emailHeaders = "From: info@1031america.com\r\nContent-type: text/html";

$emailBody = "<b>1031America Website Contact Form</b><P></P>";
foreach ($_POST as $key => $value) {
$emailBody .= "<b>".$key."</b>: ".$value."<P></P>";
}

//this should be your client's email address
$emailRecipient = "info@1031america.com";

//change "EMAIL subject" to whatever you want
$emailSubject = "1031America Website Contact Form";

mail($emailRecipient, $emailSubject, $emailBody, $emailHeaders);
?>