Hallo,

Ik heb een handelmail php pagina die werkt op meerdere pagina's icm contactformulieren.
Nu heb ik een website waar ik deze foutmelding krijg:
Warning: Cannot modify header information - headers already sent by (output started at /customers/9/e/c/grandcafexity.nl/httpd.www/handelmail.php:4) in /customers/9/e/c/grandcafexity.nl/httpd.www/handelmail.php on line 22

Dit zijn regels 21 en verder:

/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
if (mail($adminmail,$subject,$complete_message,$headers)) {
header("Location: index.html#!/page_goed");
}
else{
header("Location: index.html#!/page_fout");
}

Wat moet ik nu doen...please help me
Hallo,

Ik had die forums natuurlijk al bekeken (en nu nog een keer) maar weet nog steeds het antwoord niet (ben niet thuis in PHP).
Vandaar een nieuwe post.

Dit is mijn volledig php bestand:
<html>
<head><title>PHP Mail Sender</title></head>
<body>
<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$sex = $_POST['geslacht'];
$name = $_POST['naam'];
$email = $_POST['email'];
$subject = $_POST['onderwerp'];
$message = $_POST['bericht'];
$adminmail = "[email protected]";

$boodschap = "Er is een mail verstuurd vanuit de website.\n\nDe volgende gegevens werden ingevuld:\n\nGeslacht= ".$sex."\nNaam= ".$name."\nEmail= ".$email."\nOnderwerp= ".$subject."\nBericht= ".$message;

$complete_message = "Je hebt een mail ontvangen"."\n\n".$boodschap;

$headers = 'From: ' .$email . "\r\n" . 'Reply-To: ' . $adminmail . "\r\n" . 'X-Mailer: PHP/' . phpversion();


/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
if (mail($adminmail,$subject,$complete_message,$headers)) {
header("Location: index.html#!/page_goed");
}
else{
header("Location: index.html#!/page_fout");
}
?>
</body>
</html>
Er mag geen enkele output naar de browser zijn VOOR een header().
Jouw eerste regel is <html> en dat is al output.
Raar dan dat hij op alle andere websites wel werkt.
Wat moet ik dan weghalen>?
alleen HTML?

Toevoeging op 28/03/2014 13:49:32:

Aangezien hij foutmelding geeft pas bij regel 22 (in dit bericht 19)

Toevoeging op 28/03/2014 13:51:48:

Ik heb het al!!! ongelooflijk bedankt :)

Reageren