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: <[email protected]>' . "\r\n"; $headers .= 'From: web form<[email protected]>' . "\r\n"; $headers .= 'Reply-to: [email protected]' . "\r\n"; $data = "Name :". $_POST['name']." <br> Website : ".$_POST['website']." <br> Phone : ".$_POST['phone']." <br> Email : ".$_POST['email']." <br> Message : ".$_POST['msg']; mail("[email protected]","web form","$data",$headers); ?> cheers guys Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/ 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: <[email protected]>' . "\r\n"; $headers .= 'From: web form<[email protected]>' . "\r\n"; $headers .= 'Reply-to: [email protected]' . "\r\n"; $data = "Name :". $_POST['name']." <br> Website : ".$_POST['website']." <br> Phone : ".$_POST['phone']." <br> Email : ".$_POST['email']." <br> Message : ".$_POST['msg']; if(mail("[email protected]","web form","$data",$headers)) { echo 'sent'; } else { echo 'not sent'; } ?> Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848416 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848423 Share on other sites More sharing options...
gevans Posted June 3, 2009 Share Posted June 3, 2009 I just showed you Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848424 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848425 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848428 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> Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848430 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848431 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848432 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848433 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 } Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848435 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848437 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: <[email protected]>' . "\r\n"; $headers .= 'From: web form<[email protected]>' . "\r\n"; $headers .= 'Reply-to: [email protected]' . "\r\n"; $data = "Name :". $_POST['name']." <br> Website : ".$_POST['website']." <br> Phone : ".$_POST['phone']." <br> Email : ".$_POST['email']." <br> Message : ".$_POST['msg']; mail("[email protected]","web form","$data",$headers); ?> Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848444 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: <[email protected]>' . "\r\n"; $headers .= 'From: web form<[email protected]>' . "\r\n"; $headers .= 'Reply-to: [email protected]' . "\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("[email protected]","web form","$data",$headers)) { echo 'sent'; } else { echo 'not sent'; ?> Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848446 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 Link to comment https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848454 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.