apolopes Posted August 28, 2009 Share Posted August 28, 2009 Hello all: I have just finished a flash website but am having problems with the contact form created... cant figure out what is wrong... So if any1 can help me out on this one :S Please feel free to check the form on the website at: www.canilwarmachine.com.br The site is taking a while to load as I am still waiting for the pictures to get them replaced btw. After loaded go to the menu and click on "contatos" <? if(!empty($HTTP_POST_VARS['form_mail']) || !empty($HTTP_POST_VARS['form_message']) || !empty($HTTP_POST_VARS['form_subject']) || !empty($HTTP_POST_VARS['form_name'])) { $to = "[email protected]"; $subject = stripslashes($HTTP_POST_VARS['form_subject']); $body = stripslashes($HTTP_POST_VARS['form_message']); $body .= "\n\n---------------------------\n"; $body .= "Mail sent by: " . $HTTP_POST_VARS['form_name'] . " <" . $HTTP_POST_VARS['form_mail'] . ">\n"; $header = "From: " . $HTTP_POST_VARS['form_name'] . " <" . $HTTP_POST_VARS['form_mail'] . ">\n"; $header .= "Reply-To: " . $HTTP_POST_VARS['form_name'] . " <" . $HTTP_POST_VARS['form_mail'] . ">\n"; $header .= "X-Mailer: PHP/" . phpversion() . "\n"; $header .= "X-Priority: 1"; if(@mail($to, $subject, $body, $header)) { echo "output=Sent"; } else { echo "output=Error"; } } else { echo "output=Error"; } ?> Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/ Share on other sites More sharing options...
trq Posted August 28, 2009 Share Posted August 28, 2009 Firstly, you should be using <?php instead of <? tags. Secondly $HTTP_POST_VARS has long been deprecated in favor of $_POST. Lastly, remove the @ (error suppression) from the call to mail) so you at least might see some error. Have you tried running this script via a html form to see what it echos? Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908056 Share on other sites More sharing options...
apolopes Posted August 28, 2009 Author Share Posted August 28, 2009 Firstly, you should be using <?php instead of <? tags. Secondly $HTTP_POST_VARS has long been deprecated in favor of $_POST. Lastly, remove the @ (error suppression) from the call to mail) so you at least might see some error. Have you tried running this script via a html form to see what it echos? Thanks for the advices. Done the first 2 bits and it is now looking like this: <?php if(!empty($_POST["sender_mail"]) || !empty($_POST["sender_message"]) || !empty($_POST["sender_subject"]) || !empty($_POST["sender_name"])) { $to = "[email protected]"; $subject = stripslashes($_POST["sender_subject"]); $body = stripslashes($_POST["sender_message"]); $body .= "\n\n---------------------------\n"; $body .= "Mail sent by: " . $_POST["sender_name"] . " <" . $_POST["sender_mail"] . ">\n"; $header = "From: " . $_POST["sender_name"] . " <" . $_POST["sender_mail"] . ">\n"; $header .= "Reply-To: " . $_POST["sender_name"] . " <" . $_POST["sender_mail"] . ">\n"; $header .= "X-Mailer: PHP/" . phpversion() . "\n"; $header .= "X-Priority: 1"; if (mail($to,$subject,$body,$header)) { echo "output=Sent"; } else { echo "output=Error"; } } else { echo "output=Error"; } ?> but it still ain´t working :S Have not tried in html and my ActionScript is looking like this on the send button: var errors:Array = new Array(); errors.length = 0; submit_button.onRelease = function() { validateForm(); } submit_button.onRollOver = function() { this.gotoAndStop(3); }; submit_button.onRollOut = function() { this.gotoAndStop(2); }; function validateForm(){ _parent.form_result.text = ""; errors.length = 0; validateEmail(); validateCode(); if(errors.length >0){ }else { sendForm(); } } function validateEmail() { if (_parent.form_email.text.indexOf("@")<2) { errors.push("@ missing in E-Mail or in wrong place."); _parent.form_result.text = "@ missing in E-Mail or in wrong place."; } if (_parent.form_email.text.lastIndexOf(".")<=(_parent.form_email.text.indexOf("@")+2)) { errors.push(". missing in E-Mail or in wrong place."); _parent.form_result.text = ". missing in E-Mail or in wrong place."; } if (_parent.form_email.text.length< { errors.push("E-Mail address not long enough."); _parent.form_result.text = "E-Mail address not long enough."; } } function validateCode(){ if (_parent.form_verif.text != _parent.codeanswer){ errors.push("Code Incorrect"); _parent.form_result.text = "Code Incorrect"; } } function sendForm(){ sender_mail = _parent.form_email.text; sender_name = _parent.form_name.text; sender_subject = _parent.form_subject.text; sender_message = _parent.form_message.text; loadVariables("sendmail.php", this, "POST"); this.onData = function() { if (this.output == 'sent') { _parent.form_result.text = "Thank You,Your message has been sent."; _parent.clearform(); } else { _parent.form_result.text = "Error,Please try again later."; } }; } the frame itself has this: stop(); var codearray:Array = new Array("00000", "dpo69", "67ekj", "6t96j", "36ewg", "d9t36", "974ki", "45907", "fhd87", "6m790", "nx6z9", "jh657", "5ihor", "0732i", "ps64b", "wgdnb", "8says", "m8fgh", "ntu58", "58fvn", "4b3jf", "vnkm6", "kjgg4", "snfdj", "5k1kd", "2ks98", "sa76m", "hd834", "59gk6", "7jmgn", "g3675"); var codeNumber:Number; var codeanswer:String; var mybackingcolor:Color = new Color(form_backing); var settingsload:LoadVars = new LoadVars(); settingsload.onLoad = function(success:Boolean) { if (success) { nofocus_border = parseInt(this.nofocus_border_var); focus_border = parseInt(this.focus_border_var); nofocus_background = parseInt(this.nofocus_background_var); focus_background = parseInt(this.focus_background_var); nofocus_color = parseInt(this.nofocus_color_var); focus_color = parseInt(this.focus_color_var); form_result.textColor = this.form_result_var; mybackingcolor.setRGB(this.form_backing_var); format_field([form_name, form_email, form_subject, form_message, form_verif]); Selection.setFocus(form_name); } else { trace("file load failed"); } }; settingsload.load("settings.txt"); randomcodemaker(); submit_holder.submit_button.enabled = false; clear_btn.onRelease = function() { clearform(); }; clear_btn.onRollOver = function() { this.gotoAndStop(2); }; clear_btn.onRollOut = function() { this.gotoAndStop(1); }; function clearform() { form_name.text = ''; form_email.text = ''; form_subject.text = ''; form_message.text = ''; form_verif.text = ''; submit_holder.submit_button.enabled = false; submit_holder.submit_button.gotoAndStop(1); Selection.setFocus(form_name); randomcodemaker(); } keypressed = new Object(); keypressed.onKeyUp = function() { if (Sname.text != '' && form_email.text != '' && form_subject.text != '' && form_verif.text != '' && form_message.text != '') { //enable btn submit_holder.submit_button.enabled = true; submit_holder.submit_button.gotoAndStop(2); } else { //diable submit_holder.submit_button.enabled = false; } }; Key.addListener(keypressed); function format_field(f) { for (var a in f) { f[a].border = true; f[a].borderColor = nofocus_border; f[a].background = true; f[a].backgroundColor = nofocus_background; f[a].textColor = nofocus_color; } } TextField.prototype.onSetFocus = function() { this.borderColor = focus_border; this.backgroundColor = focus_background; this.textColor = focus_color; }; TextField.prototype.onKillFocus = function() { this.borderColor = nofocus_border; this.backgroundColor = nofocus_background; this.textColor = nofocus_color; }; function randomcodemaker() { codeNumber = Math.floor(Math.random()*30+1); form_codebox.gotoAndStop(codeNumber); codeanswer = codearray[codeNumber]; } Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908092 Share on other sites More sharing options...
trq Posted August 28, 2009 Share Posted August 28, 2009 I would try it with a html form so you can see php response. Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908094 Share on other sites More sharing options...
apolopes Posted August 28, 2009 Author Share Posted August 28, 2009 I would try it with a html form so you can see php response. oh well, 2:21 am here... gonna get some sleep now. Hope by tomorrow someone figured it out for me so I won´t have to lose some more hair. Thanks dude. Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908097 Share on other sites More sharing options...
apolopes Posted August 28, 2009 Author Share Posted August 28, 2009 Oh well, the echo was wrong :S instead of "Sent" it should be "sent". After correcting it I get the message sent confirmation but still nothing comes on my inbox Now I really do not know what to do... Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908102 Share on other sites More sharing options...
trq Posted August 28, 2009 Share Posted August 28, 2009 The From header needs to be a valid email on the domain your server is sending from. Otherwise the email will likely go straight to spam. Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908129 Share on other sites More sharing options...
apolopes Posted August 28, 2009 Author Share Posted August 28, 2009 The From header needs to be a valid email on the domain your server is sending from. Otherwise the email will likely go straight to spam. filled the form using an email from the domain but still nothing. no emails on junk/spam either. Any other ideas? Link to comment https://forums.phpfreaks.com/topic/172227-solved-php-form-in-flash/#findComment-908294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.