|
-
Ctrl Z Ctrl Z F1 Ctrl Z Ctrl Z
php Email Sending Extra Text
Hi,
My php email is sending this in the feedback section. I have had no prblem with this email form before. Any help would be great.
<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"_sans\" SIZE=\"12\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">WORK</FONT></P></TEXTFORMAT>
below is the php and AS:
PHP Code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$feedback = $_POST['feedback'];
$subject = 'Feedback from the Website';
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
//ENTER YOUR EMAIL ADDRESS HERE
$to = '[email protected]';
//---------------------------
$success = mail($to, $subject, $feedback, $headers);
if($success){
echo '&sent=OK';
}else{
echo '&sent=Error';
}
?>
Here is the AS:
Code:
stop();
var sendData_lv:LoadVars = new LoadVars();
var receiveData_lv:LoadVars = new LoadVars();
var formValidated:Boolean;
var errorMessages:Array = new Array();
receiveData_lv.onLoad = function():Void{
trace(this.sent);
if(this.sent == "OK"){
message0_txt.text = "Thank you for your feedback";
}else{
message0_txt.text = this.sent;
}
}
submit_btn.onRelease = function() {
//this clears the error text field if they have been populate previously
clearTextFields();
errorMessages.length = 0; //empty the array so next time the submit button is clicked the array is not already populated
formValidated = checkForm();
if (formValidated) {
//the form is valid and so now we can send details to our PHP file
//populate LoadVars object with the field values
sendData_lv.name = name_txt.text;
sendData_lv.email = email_txt.text;
sendData_lv.phone = phone_txt.text;
sendData_lv.feedback = feedback_txt.text;
gotoAndStop(2);
//trace(sendData_lv.email);
//trace("valid");
sendData_lv.sendAndLoad("email.php?ck="+new Date().getTime(), receiveData_lv);
} else {
//populate textfields with the error messages
for (var i = 0; i<errorMessages.length; i++) {
_root["message"+i+"_txt"].text = errorMessages[i];
trace(errorMessages[i]);
}
}
};
function checkForm():Boolean {
//check whether the name field is empty
if (name_txt.text == "") {
errorMessages.push("Please enter your name.");
}
if (email_txt.text == "") {
errorMessages.push("Please enter your email address.");
} else if (email_txt.text.indexOf("@") == -1 || email_txt.text.indexOf(".") == -1) {
errorMessages.push("Please enter a valid email address.");
}
if (feedback_txt.text == "") {
errorMessages.push("Please enter some feedback");
}
//if at this point the array is empty i.e has length 0, then this in effect means the form has passed all checks
if (errorMessages.length == 0) {
return true;
} else {
return false;
}
}
function clearTextFields():Void {
for (var i = 0; i<errorMessages.length; i++) {
_root["message"+i+"_txt"].text = "";
;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|