triad Posted June 3, 2009 Share Posted June 3, 2009 Hi guys I am creating my first flash php form but I think there is something wrong with the php, Can anyone help me please. <?php $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: <design@triaduk.co.uk>' . "\r\n"; $headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; $headers .= 'Reply-to: design@triaduk.co.uk' . "\r\n"; $data = "Name :". $_POST['name']." <br> Website : ".$_POST['website']." <br> Phone : ".$_POST['phone']." <br> Email : ".$_POST['email']." <br> Message : ".$_POST['msg']; mail("design@triaduk.co.uk","web form","$data",$headers); ?> cheers guys Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 Does this really need to be sent in html format? <?php $headers .= 'To: <design@triaduk.co.uk>' . "\r\n"; $headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; $headers .= 'Reply-to: design@triaduk.co.uk' . "\r\n"; $data = "Name :". $_POST['name']." <br> Website : ".$_POST['website']." <br> Phone : ".$_POST['phone']." <br> Email : ".$_POST['email']." <br> Message : ".$_POST['msg']; if(mail("design@triaduk.co.uk","web form","$data",$headers)) { echo 'sent'; } else { echo 'not sent'; } ?> Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 I dont know can i do it without using html, Im a php newbie Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 I just showed you Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 Cheers for the help, but where about do i put the code Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 your flash form will submit to a specified page, the above code should be on that page Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 On the same HTML page as the form like so <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> ini_set('display_errors', 1); ini_set('error_reporting', E_ALL | E_STRICT); </head> Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 this has nothing to do with the html if you're using a flash form Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 sorry you have completely lost me, where does this line of code go, in the actionscript, inthe php script or on the page the flash files sits on. Cheers for you help Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 your flash form will submit to a specified page, the above code should be on that page The page that the flash form submits to Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 The flash form submits to a php script so do i put in the php script here is the sumission code in the flash on (release) { // Check if Email is valid function checkemail(email) { var _loc2 = new String(email); var _loc1 = _loc2.split("@"); if (_loc1.length != 2 || _loc1[1].indexOf(".") < 1) { // if email is invalid : Initial 'Email' and Show error message. emailx.text = "E-mail"; showerror("Invalid email address !!"); return (false); } else { return (true); } // end else if } // End of the function function showerror(message) { gotoAndStop("error"); error = message; } // End of the function // Fileds verification if (name != "Your name" && name != "" && email != "E-mail" && email != "" && phone != "Phone" && phone != "" && address !="Address" && address !="" && msg != "Message" && msg != "") { if (checkemail(email)) { // If all fields are valid; Send data by a php file "form.php"... loadVariables("http://www.triaduk.co.uk/dependants/form.php", "", "POST"); showerror("Sending data..."); //.. and initialise all fields. name = "Your name"; email = "E-mail"; phone = "Phone"; website = "Website"; msg = "Message"; // Show message has been sent ! error = "Your message has been sent"; } // end if } else { // If Fields are invalid; show error message showerror("All fields are required"); } // end else if } Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 The flash form submits to a php script put the php in that script Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 you mean like this <?php ini_set('display_errors', 1); ini_set('error_reporting', E_ALL | E_STRICT); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: <design@triaduk.co.uk>' . "\r\n"; $headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; $headers .= 'Reply-to: design@triaduk.co.uk' . "\r\n"; $data = "Name :". $_POST['name']." <br> Website : ".$_POST['website']." <br> Phone : ".$_POST['phone']." <br> Email : ".$_POST['email']." <br> Message : ".$_POST['msg']; mail("design@triaduk.co.uk","web form","$data",$headers); ?> Quote Link to comment Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 Try it, if it workds happy days Though as my original post said you don't need the html headers for a simple email, and use \n instead of <br> if you use a plain text email; <?php ini_set('display_errors', 1); ini_set('error_reporting', E_ALL | E_STRICT); $headers .= 'To: <design@triaduk.co.uk>' . "\r\n"; $headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; $headers .= 'Reply-to: design@triaduk.co.uk' . "\r\n"; $data = "Name :". $_POST['name']." \r\n Website : ".$_POST['website']." \r\n Phone : ".$_POST['phone']." \r\n Email : ".$_POST['email']." \r\n Message : ".$_POST['msg']; if(mail("design@triaduk.co.uk","web form","$data",$headers)) { echo 'sent'; } else { echo 'not sent'; ?> Quote Link to comment Share on other sites More sharing options...
triad Posted June 3, 2009 Author Share Posted June 3, 2009 Cheers for your help, but still no joy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.