|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
sendAndLoad
hi..
after a long time i have got flash sending variables to a php script, this was my first shot at php and it has been both very confusing and fun.. I am using LoadVars and the sendAndLoad function in flash. The variables are sent from flash to the script and the php mail method is called to send to my email address.. this works ok, however i really would like to show the status by displaying a return string from the php script. When running the code below once the email message is sent the _root.EmailStatus field goes blank but does not show the $send_answer Here is my code below, if anyone can see why i get no reply from the script?? that would be great!! php file <? //start a msg string $msg = "This Message Recieved from the Panic Stricken Bovine website:" . "\n"; $msg .= "Sender's Name:\t" . $_POST['name'] . "\n"; $msg .= "Sender's Email:\t" . $_POST['email'] . "\n"; //create a variable for the recipient's email address $to = "aztechnician@telstra.com"; //The subject of the email $subject = "WILD THINGS III"; //mail headers $mailheaders = "From:\t" . $_POST['name'] . "\n"; $mailheaders .= "Reply-To:\t" . $_POST['email'] . "\n"; //mail method mail($to, $subject, $msg, $mailheaders); $sendresult = "SUCCESS"; $send_answer = "answer="; $send_answer .= rawurlencode($sendresult); echo "&$send_answer"; ?> flash button actionscript: on (release) { if (!_root.email.length || _root.email.indexOf("@") == -1 || _root.email.indexOf(".") == -1) { _root.EmailStatus = "Please enter a valid E-mail address"; } else if (!_root.name.length) { _root.EmailStatus = "Please enter your name"; } else { scriptVars = new LoadVars(); scriptVars.name = _root.name; scriptVars.email = _root.email; scriptVars.sendAndLoad("flash.php", scriptVars, "POST"); _root.EmailStatus = "Sending... one Moment"; scriptVars.onLoad = function() { _root.EmailStatus = scriptVars.send_answer; }; } } |
|
#2
|
|||
|
|||
|
Howdy... I'm just saying hi!!!
I've seend this one somewhere... ![]() |
|
#3
|
|||
|
|||
|
run thru server??
change...
scriptVars.sendAndLoad("flash.php", scriptVars, "POST"); ...to... scriptVars.sendAndLoad("http://www.myserver.com/flash.php", scriptVars, "POST"); i'm pretty sure you have to run the script thru the server to get the output you expect...
__________________
Delenda est Carthago |
|
#4
|
|||
|
|||
|
You need to change
Code:
scriptVars.onLoad = function() {
_root.EmailStatus = scriptVars.send_answer;
};
to Code:
scriptVars.onLoad = function() {
_root.EmailStatus = scriptVars.answer;
};
Since the var you want is named answer. Not send_answer. That variable only lives in the PHP script. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > sendAndLoad |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|