So I moved the header() above the content that is displated in the web browser but it did not help :/
<?php error_reporting(6143);
require_once('recaptchalib.php');
$publickey = "6Ldmbr8SAAAAAGT17oCjkB8Y60kSqvq_0w7APAJp";
$privatekey = "6Ldmbr8SAAAAAMY5lEl-7LnkWCovoFa9G7Vl3_kA";
isset($_POST['Email']) ? $Email = $_POST['Email'] : $Email = "";
isset($_POST['name']) ? $name = $_POST['name'] : $name = "";
isset($_POST['surname']) ? $surname = $_POST['surname'] : $surname = "";
?>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<body bgcolor="#000000"></body>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_POST['Submit']))
{
//Validate form
$errormessage = "";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($name == '') { $errormessage .= "<li>Please provide your name.</li> ";}
if ($surname == '') { $errormessage .= "<li>Please provide your surname.</li>";}
if ($Email == '') { $errormessage .= "<li>What is your e-mail address?</li>";}
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email)){ $errormessage = $errormessage . "<li>This is not a valid email address!
</li>";}
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
$errormessage .= "<li>Please rewrite captcha characters</li>";
}
echo "</ul></p>";
//If errors, return error message(s) and form
if ($errormessage != "")
{ ?>
<?php
header ("Location: http://www.google.co.uk");
exit; ?>
<span class="link1"><a href="index.php">back to home page/a></span>
<img src="images/clack.JPG">
<table align="center">
<p align="center" class="err_bold">correct the following errors:</p> <span class="text_err"><ul><?=$errormessage?></span>
</table>
<?php
include("email-form.php");
} else {
//If good, mail to DL
$email_subject = "Hello, you have a new message";
$email_headers = "From: $name [$Email] \r\n";
$to = "blablabla@hotmail.com";
$message_content =
"----------------------------------------------------------------------------------\n".
" Hello\n".
"name: $name\n".
"surname: $surname\n".
"E-mail: $Email\n".
"-----------------------------------------------------------------------------------\n\n";
//Email message to Requestor
if (mail($to, $email_subject, $message_content, $email_headers))
{
//Display Sent Confirmation (Successful or NOT!) ?>
<?php
}
}
} else {
?>
<span class="link1"><a href="index.php">back to home page</a></span>
<img src="images/clack.JPG"><br>
<p class="err" align="center">Please fill the form below<br/></p>
<?php include("email-form.php");?>
<?php
};