merylvingien Posted April 5, 2010 Share Posted April 5, 2010 Hi Fellas, i am using a pretty well known contact form script from the web and have used it many times before, but on one particular site i am getting a header already sent error message come up and wondered if you guys can see the problem. <?php // ----------------------------------------- // The Web Help .com // ----------------------------------------- // remember to replace you@email.com with your own email address lower in this code. // load the variables form address bar $name = $_POST["name"]; $contact = $_POST['contact']; $message = $_POST["message"]; $verif_box = $_REQUEST["verif_box"]; // remove the backslashes that normally appears when entering " or ' $name = stripslashes($name); $message = stripslashes($message); $from = stripslashes($from); // check to see if verificaton code was correct if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ // if verification code was correct send the message and show this page mail("someone@somesite.com", ' contact form via web ', "\n $name just filled in the contact us form at somesite \n Their email address is: $contact \n Their message is: $message " , "From: $contact" ); // delete the cookie so it cannot sent again by refreshing this page setcookie('tntcon',''); } else { // if verification code was incorrect then return to contact page and show error //problem line header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true"); exit; //end of problem line } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Your message has been sent.</title> </head> rest of page <body> <div id="shadow"> <div id="pagewrapper"> <div id="header"> etc etc The code highlighted in red is the offending beast... Error message is: PHP Warning: Header may not contain more than a single header, new line detected. in /home/**/**/quickmailer.php on line 31 Quote Link to comment Share on other sites More sharing options...
ignace Posted April 5, 2010 Share Posted April 5, 2010 error_reporting(E_ALL); ini_set('display_errors', 1); In your script and error_reporting = E_ALL display_errors = On in your php.ini 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.