Jump to content

Header issue! Mail form


merylvingien

Recommended Posts

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 [email protected] 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("[email protected]", ' 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

 

Link to comment
https://forums.phpfreaks.com/topic/197652-header-issue-mail-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.