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 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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.