Script For Flash Email Form And Php

windows

Guest
Hi,<br /><br />My name is Lily and I am new to this forum.<br />Since the last post was back in 2004 I decided to start new topic.<br /><br />I have a problem making email form from flash with php to work with your server.<br />PHP code is:<br /><?<br />if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))<br />{<br />$to = "my email";<br />$subject = stripslashes($HTTP_POST_VARS['sender_subject']);<br />$body = stripslashes($HTTP_POST_VARS['sender_message']);<br />$body .= "\n\n---------------------------\n";<br />$body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";<br />$header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";<br />$header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";<br />$header .= "X-Mailer: PHP/" . phpversion() . "\n";<br />$header .= "X-Priority: 1";<br />if(@mail($to, $subject, $body, $header))<br />{<br />echo "output=sent";<br />} else {<br />echo "output=error";<br />}<br />} else {<br />echo "output=error";<br />}<br />?><br /><br />Please let me know what line should be changed, that your server receive the email form.<br />Thank you so very much.<!--content-->
Welcome to the forums Lily.<br /><br />$HTTP_POST_VARS was depreciated sometime ago. You need to either delcare $HTTP_POST_VARS as global or use $_POST as I have below.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?<br />if(!empty($_POST['sender_mail']) || !empty($_POST['sender_message']) || !empty($_POST['sender_subject']) || !empty($_POST['sender_name']))<br />{<br />$to = "my email";<br />$subject = stripslashes($_POST['sender_subject']);<br />$body = stripslashes($_POST['sender_message']);<br />$body .= "\n\n---------------------------\n";<br />$body .= "Mail sent by: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";<br />$header = "From: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";<br />$header .= "Reply-To: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";<br />$header .= "X-Mailer: PHP/" . phpversion() . "\n";<br />$header .= "X-Priority: 1";<br />if(@mail($to, $subject, $body, $header))<br />{<br />echo "output=sent";<br />} else {<br />echo "output=error";<br />}<br />} else {<br />echo "output=error";<br />}<br />?><!--c2--></div><!--ec2--><!--content-->
Thank you so much for fast reply! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br />I will try it now in meanwhile please let me know if I need to change anything in send button code.<br />Thank you in advance.<br /><br />Here is how I call the php file from flash:<br />---------------------<br />on (release) {<br />//Now import the variables we<br />//need to send in this movie clip<br />sender_mail = _root.Semail.text<br />sender_name = _root.Sname.text<br />sender_subject = _root.Ssubject.text<br />sender_message = _root.Smessage.text<br />//all the vars we just imported<br />//will be sent via POST method now<br />loadVariables("sendmail.php",this,"POST");<br />//and when receives the answer from<br />//the server...<br />this.onData = function()<br />{<br />for(var a in this) trace([a,this[a]])<br />//ok, next frame<br />_root.nextFrame();<br />if(this.output=='sent')<br />{<br />// in case of success<br />_root.errTitle = 'Thank You.';<br />_root.errType = "Your message has been succesfully sent.";<br />} else {<br />//else<br />_root.errTitle = "Error!";<br />_root.errType = "Attention, an error occurred while processing your message. Please try again later.";<br />}<br />}<br />}<br /><br />-----------------------------------<!--content-->
One more thing:<br />I just check on the server and cgi-bin is set to : mail.php<br /><br />Should I change the name of my php file?<br /><br />What doesn't work is respond from server, to get to "thank you" part .<!--content-->
Welcome to the forums Lily. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />Sorry I do not know the answer to your question but I am sure one of our better versed php/flash users will be along to offer some help.<!--content-->
Welcome to the forum, Lily. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Thank you all for nice welcome!<br />I still didn't make this to work... I would need help ,please.<br />Thanks.<br /><!--content-->
 
Top