I am trying to set up a page on a web site that has a email form that is done with a php script. It sends the email but I get this error code (the directory names have been altered)
Warning: Cannot add header information - headers already sent by (output started at /home/domain/domain-www/contact.php:2) in /home/domain/domain-www/contact.php on line 31
and this is the php script
<?
if (!isset($email) || !isset($message)) {
header( "Location: <A HREF="http://www.domain.com/feedback.html"" TARGET=_blank>http://www.domain.com/feedback.html"</A> );
}
elseif (empty($email) || empty($message) || empty($name)) {
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
?>
<HTML>
<HEAD><TITLE>Error& ;lt;/TITLE></HEAD>
<BODY>
<h1>Error</h1>
<p>
Oops, it appears you forgot to enter either your
email address, name or your message. Please press the BACK
button in your browser and try again.
</p>
</BODY>
</HTML>
<?
}
else {
mail( "webmaster@domain.com", "form mail",
$message, "From: $name <$email>" );
header( "Location: <A HREF="http://www.domain.com/thankyou.html"" TARGET=_blank>http://www.domain.com/thankyou.html"</A> );
}
?>
Does anybody know how to get rid of the error? Thanks.