PDA

View Full Version : help with php email?


rororo
11-09-2006, 09:10 PM
Hi everyone,

I've created a form within flash to send using php... For some reason, every tutorial that i tried didn't work out. so, i tried it out myself... and it's nearly workign (i think?!). I'm getting an error from the php when i send the test mail. in other words, the variables are apparently being passed, but something inside the php code is causing problems...

can anyone help?

thanks!this is my code:

<?
if(!empty($_POST['senderMail'])
|| !empty($_POST['senderMessage'])
|| !empty($_POST['senderSubject'])
|| !empty($_POST['senderName']))
{
$to = "my@address.com";
$sName = $_POST['senderName'];
$sMail = $_POST['senderMail'];
$subject = $_POST['senderSubject'];
$body = $_POST['senderMessage'];
$body .= "\n\n---------------------------\n";
$body .= "Mail sent by: $sName <$sMail>\n";
$header = "From: $sName <$sMail>\n";
$header .= "Reply-To: $sName <$sMail>\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 3";
if(@mail($to, $subject, $body, $header))
{
echo "output=sent";
} else {
echo "output=error";
}
} else {
echo "output=errorMain";
}
?>


and here's my actionscript:
sendBtn.onRelease = sendBtn.onReleaseOutside = function () {
if (nameArea.text == "" || emailArea.text == "" || commentsArea.text == "") {
statusMC.statusTxt.text = "Please fill out all three fields.";
} else {
sendForm();
}
}

//================================================== ========================
var feedbackForm:LoadVars = new LoadVars ();

function sendForm () {
feedbackForm.senderMail = emailArea.text;
feedbackForm.senderName = nameArea.text;
feedbackForm.senderSubject = 'Visitor from the site';
feedbackForm.senderMessage = commentsArea.text;
this.loadVariables("sendmail.php",feedbackForm,"POST");

this.onData = function(output){
if(output == 'sent') {
statusMC.statusTxt.text = "Thank You, your message has been succesfully sent";
} else {
if (output == 'errorMain'){
statusMC.statusTxt.text = "Main Error";
} else {
statusMC.statusTxt.text = "Inside Error";
}
}
}
}

so i get "inside error" sent back to the flash site all the time....

thanks again

amirc
11-10-2006, 11:12 AM
I think you need to do like that:
"feedbackForm.output =="