-
php confirming sent mail to flash?
hi guys...i have a simple simple mail script that works fine. I am sending variables from Flash to php, but i would like a sort of call back from php to flash that says "ok Flash, tell the user it's all good"...then when Flash gets that, it does the desired effect. Ok, so i know the lv.sendAndLoad(url, lvGet,"GET") function, and i have another lv that is all ready to receive (lvGet.onLoad=function)...but what do i add to the php to talk back with flash??
<?php
$name=$_GET['name'];
$email=$_GET['email'];
$phone=$_GET['phone'];
$note=$_GET['note'];
$to="me@me.com";
$subject="Visitor from Me.com";
mail($to,$subject,$note);
?>
-
with a mail function you can usually do
PHP Code:
if (mail($to, $subject, $note)) {
print "mail sent";
} else {
print "sending error";
}
so if you can substitute those print lines to tell your flash the same info then that should work.
-
so, substitutue with something that the loadVars can read? Like echo("&reply=good&")??
-
Hi,
you have to use sendandload to retrieve the result, a separate load does not work
On most servers mail returns nothing useful - success means that there was enough disk space to put the message in the outgoing queue, and failure would happen if the admin has blocked the mail function.
Musicman
-
Challenging Convention
the way i do it is to send vars to my php mailer form and set up timeout period:
loadVariables(_rootirURL+"/scripts/enquiry_processor.php", this, "POST");
TimeOutMax = 80;
TimeOutLoop = 0;
and then go to a loop on the timeline (frame label = "ServerCheck") with:
if (result == "Okay") {
gotoAndPlay("Success");
} else if (result == "Fail") {
gotoAndPlay("Error");
}
(then a couple of frames later)
TimeOutLoop++;
if (TimeOutLoop>TimeOutMax) {
trace("Sending Form Data Has Timed Out");
status = "Sorry "+_root:firstname+", The server seems to be taking longer than normal to confirm receipt of your details. Please check your internet connection and try submitting the form again. <br><br>If this problem continues and your internet connection appears to be fine, our servers may be experiencing a temporary difficulty.";
gotoAndPlay("Error");
} else {
gotoAndPlay("ServerCheck");
}
and then last line on the php script (enquiry_processor.php):
// Confirm Success Back To Flash
$output = "&result=Okay";
echo $output ;
Job done...
Hope that helps...
Cheers
Andy
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
|