super_man Posted November 27, 2006 Share Posted November 27, 2006 Hi There,Im very new at this and I appreciate any positive help on this: Ive created a flash site with TextInput components so people can put their name and so forth. Each TextInput has an instance name. When the Submit Button is pressed, the flash site goes to a Sending Page that states "Your form has been Sent" Once the form has been sent successfully, the flash site then goes to a Thank You page. This process is working but when I test this, I check my email and all of the TextInput fields are blank, none of the info the user has typed is being sent.Here is my PHP file:<?php$to = '[email protected]';$subject = 'Registration Form';$message = 'From: '.$_POST['from']."\n\n";$message = 'Name: '.$_POST['name']."\n\n";$message = 'email: '.$_POST['email']."\n\n";$message = 'Dbirth: '.$_POST['dbirth']."\n\n";$message = 'Parent: '.$_POST['parent']."\n\n";$message = 'Address: '.$_POST['address']."\n\n";$message = 'City: '.$_POST['city']."\n\n";$message = 'State: '.$_POST['state']."\n\n";$message = 'Zipcode: '.$_POST['zipcode']."\n\n";$message = 'Phone: '.$_POST['phone']."\n\n";$message = 'Ephone: '.$_POST['ephone']."\n\n";$message = 'Econtact: '.$_POST['econtact']."\n\n";$additionalHeaders = "From: Registration Form<[email protected]>\n";$additionalHeaders .= 'Reply-To: '.$_POST['email'];$OK = mail($to, $subject, $message, $additionalHeaders);if ($OK) {echo 'sent=OK';}else {echo 'sent=failed&reason='.urlencode('There seems to be a problem with the server. Please try again later.');}?>Here is what I have in Flash (actionscript) message.name = name.text;message.dbirth = email.text;message.parent = parent.text;message.address = address.text;message.city = city.text;message.state = state.text;message.zipcode = zipcode.text;message.phone = phone.text;message.ephone = ephone.text;message.email = email.text;message.econtact = econtact.text;Here is what the Email looks like :Subject: Registration FormFrom:Name:email:Dbirth:Parent:Address:City:State:Zipcode:Phone:Ephone:Econtact:Any help would be appreciated, Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/ Share on other sites More sharing options...
trq Posted November 27, 2006 Share Posted November 27, 2006 Can we see the action for the button in flash? We need to make sure your actually sending via POST. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131210 Share on other sites More sharing options...
super_man Posted November 27, 2006 Author Share Posted November 27, 2006 Here is all the actionscript I have :submit_btn.onRelease = sendMessage;error1_txt.autoSize = true;error2_txt.autoSize = true;error3_txt.autoSize = true;error4_txt.autoSize = true;error5_txt.autoSize = true;error6_txt.autoSize = true;error7_txt.autoSize = true;error8_txt.autoSize = true;error9_txt.autoSize = true;error10_txt.autoSize = true;error11_txt.autoSize = true;error12_txt.autoSize = true;function checkForm():Boolean { var missing:Boolean = false; error1_txt.text = error2_txt.text=error3_txt.text=error4_txt.text=error5_txt.text=error6_txt.text=error7_txt.text=error8_txt.text=error9_txt.text=error10_txt.text=error11_txt.text=""; if (name.text == "") { error1_txt.text = "Error"; missing = true; } if (dbirth.text == "") { error2_txt.text = "Error"; missing = true; } if (parent.text == "") { error3_txt.text = "Error"; missing = true; } if (address.text == "") { error4_txt.text = "Error"; missing = true; } if (city.text == "") { error5_txt.text = "Error"; missing = true; } if (state.text == "") { error6_txt.text = "Error"; missing = true; } if (zipcode.text == "") { error7_txt.text = "Error"; missing = true; } if (phone.text == "") { error8_txt.text = "Error"; missing = true; } if (ephone.text == "") { error9_txt.text = "Error"; missing = true; } if (email.text == "") { error10_txt.text = "Error"; missing = true; } if (econtact.text == "") { error11_txt.text = "Error"; missing = true; } if (sign.CheckBox == "") { error12_txt.text = "Error"; missing = true; } return missing ? false : true;}function sendMessage():Void { // check wheather form has been correctly filled in var formOK:Boolean = checkForm(); // if no problems, process the form and send variables to PHP script if(formOK) { message.name = name.text; message.dbirth = email.text; message.parent = parent.text; message.address = address.text; message.city = city.text; message.state = state.text; message.zipcode = zipcode.text; message.phone = phone.text; message.ephone = ephone.text; message.email = email.text; message.econtact = econtact.text; //display message informing user that email is being sent gotoAndStop("sending"); }};function backToForm():Void { //send playhead back to the main form gotoAndStop("register");}messageSent.onLoad = function() { if(this.sent == "OK") { gotoAndStop("acknowldedge"); }else{ gotoAndStop("failure"); failure_txt.text = this.reason; }};message.sendAndLoad("chivasreg.php?ck=" +new Date().getTime(), messageSent); Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131237 Share on other sites More sharing options...
corbin Posted November 28, 2006 Share Posted November 28, 2006 Try the variables as $message .= "new stuff";.= means the same as $message = $message . "new stuff";That way instead of erasing the old data itll add to it...That might not be the problem though... Didnt thoroughly look through your code and Im no flash expert (been messin with it like 3 days ><)If its not it try changing the file that processes it to [code=php:0]<?session_start();foreach($_GET as $k => $v) {$_SESSION[$k] = $v;}?>[/code]then make a new page and make it [code=php:0]<?session_start();print_r($_SESSION);?>[/code]Then fill out the form and all that fun stuff then go to the second page in the same browser window and see what it says Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131245 Share on other sites More sharing options...
trq Posted November 28, 2006 Share Posted November 28, 2006 You dont specify a method in your call to sendAndLoad and Im quite sure it defaults to get. Try...[code]message.sendAndLoad("chivasreg.php?ck="+new Date().getTime(), messageSent,"POST");[/code] Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131250 Share on other sites More sharing options...
super_man Posted November 28, 2006 Author Share Posted November 28, 2006 [quote author=thorpe link=topic=116514.msg474777#msg474777 date=1164673994]You dont specify a method in your call to sendAndLoad and Im quite sure it defaults to get. Try...[code]message.sendAndLoad("chivasreg.php?ck="+new Date().getTime(), messageSent,"POST");[/code][/quote]Hey, I tried that and added "POST" like you said and the email response I get still do not show the values I put in on the flash form. Everything is still blank and when I hit the back button it sends another email with blank values..... uggghhhh this is driving me nuts...lol. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131259 Share on other sites More sharing options...
trq Posted November 28, 2006 Share Posted November 28, 2006 Sorry, but you'll also need to do as corbin suggested and add the dot between your message variables. eg;[code=php:0]$message = 'From: '.$_POST['from']."\n\n";$message .= 'Name: '.$_POST['name']."\n\n";$message .= 'email: '.$_POST['email']."\n\n";$message .= 'Dbirth: '.$_POST['dbirth']."\n\n";$message .= 'Parent: '.$_POST['parent']."\n\n";$message .= 'Address: '.$_POST['address']."\n\n";$message .= 'City: '.$_POST['city']."\n\n";$message .= 'State: '.$_POST['state']."\n\n";$message .= 'Zipcode: '.$_POST['zipcode']."\n\n";$message .= 'Phone: '.$_POST['phone']."\n\n";$message .= 'Ephone: '.$_POST['ephone']."\n\n";$message .= 'Econtact: '.$_POST['econtact']."\n\n";[/code]Other then that, Id'e say this is a flash issue. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131287 Share on other sites More sharing options...
corbin Posted November 28, 2006 Share Posted November 28, 2006 I could write it from scratch in flash... but some parts of your code are gibberish to me... Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131293 Share on other sites More sharing options...
super_man Posted November 28, 2006 Author Share Posted November 28, 2006 Success, well I got some good news .... I am now getting 2 emails from the flash form .... 1 with blank values and if I hit the register button again to go back to the registration form ... the values that I put in last now show up in the 2nd email ... so its kind of working ... but Im not sure where to go with this... Why would hitting the register button again make the values I put in finally show up in the registration email ? Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131300 Share on other sites More sharing options...
super_man Posted November 28, 2006 Author Share Posted November 28, 2006 [quote author=corbin link=topic=116514.msg474821#msg474821 date=1164677147]I could write it from scratch in flash... but some parts of your code are gibberish to me...[/quote]Hey Corbin, to be honest all the actionscript you see here came out of a book Im reading about Flash and PHP. I just renamed a few of the values to the instance names of what I have already designed. What can I remove or tweak to make this better/work? Also ** Thanks to all who are helping, I really appreciate all the feedback. Its nice to know you can count on people to help when you need it.** Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131302 Share on other sites More sharing options...
corbin Posted November 28, 2006 Share Posted November 28, 2006 Umm lemme go eat and Ill write something. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131303 Share on other sites More sharing options...
super_man Posted November 28, 2006 Author Share Posted November 28, 2006 Eat, whats that? Cool man ... thanks. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131309 Share on other sites More sharing options...
super_man Posted November 28, 2006 Author Share Posted November 28, 2006 Ok, so ... in my madness Ive decided to write another fla with 3 simple TextInput's1. Name2. Email3. Comments ...Here is my PHP file<?$to = '[email protected]';$subject = 'Comments from [email protected]';$message = 'From: '.$POST['email']."\n\n";$message .= 'Name: '.$POST['name']."\n\n";$message .= 'Comments: '.$POST['comments']."\n\n";$additionalHeaders = "From: Comments Section<[email protected]>\n";$additionalHeaders .= 'Reply-To: '.$POST['email'];$OK = mail($to, $subject, $message, $additionalHeaders);?> Flash Actionscript:stop();function checkForm():Boolean { var missing:Boolean = false; error1_txt.text = error2_txt.text=error3_txt.text=""; if (name.text == "") { error1_txt.text = "Please Fill in Your Name"; missing = true; } if (email.text == "") { error2_txt.text = "Please Fill In Your Email Address"; missing = true; } if (comments.text == "") { error3_txt.text = "No Comments?"; missing = true; } return missing ? false : true;}error1_txt.autoSize = true;error2_txt.autoSize = true;error3_txt.autoSize = true;submit_btn.onRelease = sendMessage;function sendMessage():Void { //check weather form has been correctly filled in var formOK:Boolean = checkForm(); //if no problems, process the form and send variables to PHP script if (formOK) { message.name = name.text; message.email = email.text; message.comments = comments.text;message.sendAndLoad("email.php?ck=" + new Date().getTime(), messageSent,"POST"); //display message informing user that email has been sent gotoAndStop("thankyou"); }};//initialize LoadVars to send form data//and receive response frin the PHP scriptvar message:LoadVars = new LoadVars();var messageSent:LoadVars = new LoadVars();Once again, the email shows up with the Value Names but no values that you entered in the Form. Is there something wrong with Flash? This should be so simple but life is playing a cruel joke on me....lol Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131323 Share on other sites More sharing options...
trq Posted November 28, 2006 Share Posted November 28, 2006 [quote]Is there something wrong with Flash? This should be so simple but life is playing a cruel joke on me....lol[/quote]Well, there is nothing wrong with your php. I was hinting at it earlier, I suggest you post your question on a flash board. Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131328 Share on other sites More sharing options...
corbin Posted November 28, 2006 Share Posted November 28, 2006 $message = 'From: '.$POST['email']."\n\n";$message .= 'Name: '.$POST['name']."\n\n";$message .= 'Comments: '.$POST['comments']."\n\n";should be $message = 'From: '.$_POST['email']."\n\n";$message .= 'Name: '.$_POST['name']."\n\n";$message .= 'Comments: '.$_POST['comments']."\n\n"; Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131352 Share on other sites More sharing options...
corbin Posted November 28, 2006 Share Posted November 28, 2006 Finished with my little flash-php email script if anyone cares... http://corbin.no-ip.org/flashemail/ <-- live copy http://corbin.no-ip.org/flashemail/flashemail.zip <-- source codes Link to comment https://forums.phpfreaks.com/topic/28671-need-help-with-sending-feedback-from-flash-8-by-email/#findComment-131356 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.