Bengal Posted July 29, 2008 Share Posted July 29, 2008 Hi everyone, I am new to the world of php, and scripting in general so bare with me... What I am trying to do is connect a nice little form (within a flash file) to a php scrip and have it send the form information to an email address. I am working with a set of templates... Within the flash file I have 4 text fields. (Btw, you can see said flash file here: http://www.bengalworks.com/lindsay/ ) Name, Email, Phone Number, and Comments. WIthin the flash file their respective variables are named: your_name, your_email, your_phone, and message The send button in the flash file has the following actionscript associated with it: on (rollOver) { this.gotoAndPlay("s1"); } on (releaseOutside, rollOut) { this.gotoAndPlay("s2"); } on (release) { for (i=1; i<_parent.fields_descriptions.length; i++) { if (_parent[_parent.fields_descriptions[i][1]]!=undefined) { this[_parent.fields_descriptions[i][1]]=_parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2]; } } this.recipient=_parent.rec; i=undefined; getURL("contact."+_parent.serv, "_blank", "POST"); } The templates also included a .php file and a .asp file.. (contact.php and contact.asp), Here they are: contact.php: <? Error_Reporting(E_ALL & ~E_NOTICE); while ($request = current($_REQUEST)) { if (key($_REQUEST)!='recipient') { $pre_array=split ("&777&", $request); $post_vars[key($_REQUEST)][0]=$pre_array[0]; $post_vars[key($_REQUEST)][1]=$pre_array[1]; } next($_REQUEST); } reset($post_vars); $subject="From ".$post_vars['your_name'][0] ; $headers= "From: ".$post_vars['your_email'][0] ."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; $message=''; while ($mess = current($post_vars)) { if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) { $message.="<strong>".$mess[1]."</strong> ".$mess[0]."<br>"; } next($post_vars); } mail($_REQUEST['recipient'], $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> ".$message." </body> </html>" , $headers); echo ("Your message was successfully sent!"); ?> <script> resizeTo(300, 300); </script> and contact.asp: <% for i=1 to 7 message=Request("message") next message=message + Request("message") smtpServer = "enter your SMTP SERVER HERE" smtpPort = 25 name = Request("Your_Name:") Set myMail = CreateObject("CDO.Message") myMail.Subject = "from " & name myMail.From = Request("Your_Email:") myMail.To = Request("recipient") myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort myMail.Configuration.Fields.Update myMail.Send %> I know that I need to configure something... I don't exactly know how and why the .asp file was included or where it fits in... Pretty much I have no idea where to go from here. I tried to figure it out but it just does not happen. Any help would be greatly appreciated. Thank you. Link to comment https://forums.phpfreaks.com/topic/117211-flash-form-mailer/ Share on other sites More sharing options...
dubc07 Posted July 29, 2008 Share Posted July 29, 2008 Forget the asp and stick with the php Replace code inside flash with the following.... on (rollOver) { this.gotoAndPlay("s1"); } on (releaseOutside, rollOut) { this.gotoAndPlay("s2"); } on (release) { for (i=1; i<_parent.fields_descriptions.length; i++) { if (_parent[_parent.fields_descriptions[i][1]]!=undefined) { this[_parent.fields_descriptions[i][1]]=_parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2]; } } this.recipient=_parent.rec; i=undefined; getURL("contact.php" "_blank", "POST"); } Now than here's the php. copy and paste this in place of the code inside contact php. <?php Error_Reporting(E_ALL & ~E_NOTICE); while ($request = current($_REQUEST)) { if (key($_REQUEST)!='recipient') { $pre_array=split ("&777&", $request); $post_vars[key($_REQUEST)][0]=$pre_array[0]; $post_vars[key($_REQUEST)][1]=$pre_array[1]; } next($_REQUEST); } reset($post_vars); $subject="From ".$post_vars['your_name'][0] ; $headers= "From: ".$post_vars['your_email'][0] ."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; $message=''; while ($mess = current($post_vars)) { if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) { $message.="<strong>".$mess[1]."</strong> ".$mess[0]."<br>"; } next($post_vars); } $recipient='[email protected]';////put your email address you would like the message to goto here mail($_REQUEST["$recipient"], $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> ".$message." </body> </html>" , $headers); echo ("Your message was successfully sent!"); ?> <script> resizeTo(300, 300); </script> Hope this helps. Link to comment https://forums.phpfreaks.com/topic/117211-flash-form-mailer/#findComment-603007 Share on other sites More sharing options...
Bengal Posted July 29, 2008 Author Share Posted July 29, 2008 First off, thank you so much for your help! When I put in the new actionscript it seems to have an error. I have tried just running the old scrip with the new .php when I do this it gives me the following error? Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/1.3.33 Server at www.bengalworks.com Port 80 Is there something I need to configure with GoDaddy? I have uploaded the page with the scripts you suggested but as you can see the send button won't even complete its rollover stuff... I don't quite know why. Thanks again... Thanks -Todd [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/117211-flash-form-mailer/#findComment-603111 Share on other sites More sharing options...
dubc07 Posted July 29, 2008 Share Posted July 29, 2008 GoDaddy may not have the mail function turned on which allows you to submit mail through there system using php or asp But this is rare. Contact them and tell them what your trying to do. and they should help. Also if your using an FTP manager make sure your chmod is set to 666 or 777 on the contact.php file also for the actionscript use this instead getURL("contact.php","_blank", "POST"); leave out the } Link to comment https://forums.phpfreaks.com/topic/117211-flash-form-mailer/#findComment-603114 Share on other sites More sharing options...
revraz Posted July 29, 2008 Share Posted July 29, 2008 Do you have access to the log file to see what the error was? Link to comment https://forums.phpfreaks.com/topic/117211-flash-form-mailer/#findComment-603116 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.