I have a contact page and a contact form with five Input fields and the instance names of the five fields are like this
1.theName
2.theCompany
3.theEmail
4.thePhone
5.theMessage
After filling all the fields the form did not send mail only it will go to the frame named “wait” and sit there for endless time no progress further.Where I am going wrong can somebody make necessary amendments please. I am putting here all the codes please take a look.
Action Script Code I used
stop();
thePhone.restrict = "0-9";
theName.tabIndex = 1;
theCompany.tabIndex = 2;
theEmail.tabIndex = 3;
thePhone.tabIndex = 4;
theMessage.tabIndex = 5;
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();
bt.onRelease = function() {
if (theName.text == "") {
errorTxt.text = "Enter your name ";
} else if (theCompany.text == "") {
errorTxt.text = "Your Company Name Please";
} else if (theEmail.text.indexOf("@") == -1) {
errorTxt.text = " Enter An Valid Email";
} else if (thePhone.text == "") {
errorTxt.text = "Enter Your Phone Number ";
} else if (theMessage.text == "") {
errorTxt.text = "Enter Your Message ";
} else {
errorTxt.text = "";
senderLoad.theName = theName.text;
senderLoad.theCompany = theCompany.text;
senderLoad.theEmail = theEmail.text;
senderLoad.thePhone = thePhone.text;
senderLoad.theMessage = theMessage.text;
senderLoad.sendAndLoad("mail.php", receiveLoad);
gotoAndStop("wait");
}
};
receiveLoad.onLoad = function() {
if (this.sentOk) {
this.gotoAndStop("success");
} else {
this.gotoAndStop("failed");
}
};
and the php code is here
<?PHP
$theName = $_REQUEST["theName"];
$theCompany=$_REQUEST["theCompany"];
$theEmail = $_REQUEST["theEmail"];
$thePhone = $_REQUEST["thePhone"];
$theMessage = $_REQUEST["theMessage"];
$to = "abc@gmail.com";
$subject = "Feedback from Site";
$message = "Name:" . $theName;
$message .= "Company:" . $theCompany;
$message .= "
Email:" . $theEmail;
$message .= "
Phone:" . $thePhone;
$message .= "
Message:" . $theMessage;
$headers = "From: ". $theName . " " . "<" . $theEmail. ">
";
$headers .= "Reply-To: " . $theEmail. "
";
$headers .= "Return-path: ". $theEmail;
$sentOk = mail($to,$subject,$message,$headers);
echo"sentOk=" . $sentOk;
?>
Please help me , I am puzzled with this one.
Please