wsuarez Posted February 6, 2010 Posted February 6, 2010 Hello, Hoping one of you can help me with this page: http://www.bhfhorses.com/contact_PHP.htm The error I get is: Warning: Cannot modify header information - headers already sent by (output started at /home/bhfhors/public_html/process_form.php:1) in /home/bhfhors/public_html/process_form.php on line 39 The page that is called to perform the email of the results contains: ><?php /* INSTRUCTIONS ************** * 1) Change the 'emailTo' variable (below) from "you@****** (Your Name)" to your own email and your own name * 2) Change the 'emailFrom' variable (below) from "******" to your own domain (no www required) * 3) a) Change the 'redirect' variable (below) from "www.******" to your own domain. * Make sure you have a "thank_you.htm" in the root folder of your website * 4) Make sure that each of your for elements on the page that submits to this script are named * ike the following: <input type=text name="INFO__User_Name"> * NOTE: You cannot have spaces in the name of the for element. * ie: GOOD element name "INFO__User_Name" * BAD element name "INFO__User Name" * 5) Set the "action" of the form to "process_form.php" in the form page that submits to this script * Example: <form method='post' action='process_form.php'> * 6) Submit form to make sure all required information gets emailed to you. If not, then go through steps 4 and 5 again. */ // CONFIGURATION SETTINGS $emailTo = "webmaster@bhfhorses.com (Breezy Hill Farm)"; $emailFrom = "noreply@bhrhorses.com (Breezy Hill Farm Form Results)"; $subject = "Web Form Results"; $redirectURL = "http://www.bhfhorses.com/contact_confirmation.htm"; // PLACE ALL FIELDS PASSED IN FROM FORM INTO MESSAGE BODY foreach ($_POST as $key => $value) { $keyInfo = explode("__", $key); if ($keyInfo[0] == "INFO") { $message .= $keyInfo[1].":\n ".$value."\n\n"; } } // SEND EMAIL mail($emailTo, $subject, $message, "From: ".$emailFrom); // REDIRECT TO SPECIFIED THANK YOU PAGE header("Location: $redirectURL"); ?> Any ideas out there? Thanks in advance, Bill Suarez Quote
TCH-Dick Posted February 6, 2010 Posted February 6, 2010 This error is due to the script outputting something before calling the header() redirect on line 39. However, there is nothing in that script to output prior to that line. Therefore, there has to be a space or other issue prior to <?php tag. I took a peak at your script via cPanel and looked for this and found no issue. I then checked it further from the backend and was able to find a some odd code just prior to the opening tag, this appeared to be from a text editor. I have now removed that code and your script should function correctly. Quote
wsuarez Posted February 6, 2010 Author Posted February 6, 2010 Well thank you very much, I'm not sure I ever would have figured that one out on my own. I just sent a form to myself and it works great. Thanks again, Bill Quote
carbonize Posted February 7, 2010 Posted February 7, 2010 If the weird text was about three or four characters it could be a mangled BOM header from the text editor. This can happen with some editors when saving file as UTF-8. Quote
TCH-Dick Posted February 7, 2010 Posted February 7, 2010 If the weird text was about three or four characters it could be a mangled BOM header from the text editor. This can happen with some editors when saving file as UTF-8. That's it, thanks. I have seen the same issue before wasn't sure what those characters() were. Quote
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.