|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
flash and email
Hello I'm having problems with a flash form sending an email via php. The thing is it all works except for the part in php that sends a message back to flash saying the message has been mailed.
In my actionscript I have: this.userData = new LoadVars(); this.userData.FormatChk1 = FormatChk1.getValue(); this.userData.Name = Name; this.userData.Email = Email; this.userData.sendAnswer ="sending your message, please wait"; EmailStatus = this.userData.sendAnswer; var mailServer = "email.php"; this.userData.sendAndLoad(mailServer, userData, "POST"); // look for variables named send_answer and print it EmailStatus = String(this.userData.sendAnswer); In PHP I have the following: $sendresult = "thank you for your interest. You will receive a confrimation email shortly"; $sendAnswer = "answer="; $sendAnswer .= $sendresult; echo "&$sendAnswer"; //print "sendAnswer=".urlencode($sendAnswer); |
|
#2
|
||||
|
||||
|
First you should uncomment the print line (remove the //), second remove the echo line. The first var Flash receives should not have an ampersand (&) leading into it.
Second make sure that your message is the first thing being sent. In your flash debugger you should see the data being returned somewhere even if it is not loading where you expected it too ( even though your syntax looks correct from here) Looking for leading whitespace and what not. If these don't work, post again with more details such as what is being returned in the debugger Vars window such as userData. Good luck
__________________
--the key to life is avoiding death-- |
|
#3
|
|||
|
|||
|
still not working
Well its still not working. I don't know what's wrong. Maybe someon can take a look at it and let me know I forgot a ; or have some white spacesomewhere or f'd it up good and where this is.
I can only upload the php file so here's the actionscript: on (release) { // First we validate all variable and write the error message if (!FormatChk1.getValue(false)&& !FormatChk2.getValue(false)) { EmailStatus = "ENTER VIDEO FORMAT"; } else if (!ReelChk1.getValue(false) && !ReelChk2.getValue(false) && !ReelChk3.getValue(false) && !ReelChk4.getValue(false) && !ReelChk5.getValue(false) && !ReelChk6.getValue(false) && !ReelChk7.getValue(false)) { EmailStatus = "ENTER REEL"; } else if (!Name.length) { EmailStatus = "ENTER NAME"; } else if (email.indexOf(" ") != -1 || email.indexOf("@") == -1 || email.indexOf(".") == -1 || email.length<6 || email.lastIndexOf(".")<email.indexOf("@")) { EmailStatus = "INVALID EMAIL"; } else if (!Phone.length) { EmailStatus = "ENTER PHONE NUMBER"; } else if (!Company.length) { EmailStatus = "ENTER COMPANY NAME"; } else if (!Address.length) { EmailStatus = "ENTER ADDRESS"; } else if (!City.length) { EmailStatus = "ENTER CITY"; } else if (!Province.length) { EmailStatus = "ENTER PROVINCE/STATE"; } else if (!Postal.length) { EmailStatus = "ENTER POSTAL/ZIP CODE"; } else { this.userData = new LoadVars(); this.userData.FormatChk1 = FormatChk1.getValue(); this.userData.FormatChk2 = FormatChk2.getValue(); this.userData.ReelChk1 = ReelChk1.getValue(); this.userData.ReelChk2 = ReelChk2.getValue(); this.userData.ReelChk3 = ReelChk3.getValue(); this.userData.ReelChk4 = ReelChk4.getValue(); this.userData.ReelChk5 = ReelChk5.getValue(); this.userData.ReelChk6 = ReelChk6.getValue(); this.userData.ReelChk7 = ReelChk7.getValue(); this.userData.Name = Name; this.userData.Email = Email; this.userData.Company = Company; this.userData.Address = Address; this.userData.City = City; this.userData.Province = Province; this.userData.Postal = Postal; this.userData.Additional = Additional; this.userData.Additional = "sending mail"; var mailServer = "email.php"; //this.userData.sendAndLoad(mailServer,userData, "POST"); //this.userData.sendAndLoad(mailserver, this, "POST"); //this.userData.loadVariablesNum(mailserver, this, "POST"); getURL (mailserver, userdata, "POST"); // look for variables named send_answer and print it // Status of message EmailStatus = this.userdata.sendAnswer; //EmailStatus = "Your requst has been sent, you should receive an email confirming your request shortly"; }// end of else }// end of script |
|
#4
|
||||
|
||||
|
there's two immediate problems with the php script in the last few lines of code.
1.Change this PHP Code:
PHP Code:
2.Change this PHP Code:
PHP Code:
Valid Flash format goes like this: varName1=my data here&varName2=more data here what you have now does this: &varName1=my data here&varName2=more data here= Notice the beginning & symbol and the trailing = sign. To really get the full scope you should run Ctrl>Debug Movie. In the variables window, you will find your data being returned from php inside the movie clip that requested it (unless you specify a different target). see if you can find your message "thank you for your interest...." If so, see what var name it is loading under. |
|
#5
|
|||
|
|||
|
okay the error then is in my actionscript because what I'm gettting under vaiables is under the submit I get all the code in my email.php file
I don't get a variable = to the "thank you " message. Further down where I call the value of the thank you message from the LoadVars it says the value is undefined. So it seems to me that it's not running the php script and so php isn't sending back the variables. Do you mind taking another look at it? Thanks |
|
#6
|
||||
|
||||
|
//this.userData.sendAndLoad(mailServer,userData, "POST");
//this.userData.sendAndLoad(mailserver, this, "POST"); //this.userData.loadVariablesNum(mailserver, this, "POST"); Can I ask, what is the purpose of this code? |
|
#7
|
|||
|
|||
|
Sure,
These were teh various methods I was experimenting with to pass the variables to the php script. getURL isn't the one I want to use because it will open up a new window for email.php. I want it to run seemlessly inthe background so I was using the above commands. For testing though I used getURL because it will display the variables I want. However the final script uses the first sendAndLoad, and its here that I'm having problems. WHen I run the debugger and see the variables I don't see the ouput from my php file but my entire php script. the place where it outputs the variables passed to flash is still undefined. |
|
#8
|
|||
|
|||
|
OK , I've looked at it some more and in my actionscript I've added this line after my sendAndLoad this.userData.onLoad = function(success) {
EmailStatus.text = userData.sendAnswer; } Now the load section isn't undefined but I still can't call up the variable in PHP that gives teh mail sent message. When I put a trace statement in front of it it's sending it all the variable to the mail file. When I put it inside the load function I don't get any response. Any ideas? |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > flash and email |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|