0

I've created a mail form. A PHP page reads the input, sends it out to a mail and then it should redirect to a certain page. Pretty straight forward, done it before. The mail gets send, but you don't get redirected.

HTML form:

<form action="mailversturen.php" method="post">
<input type="text" name="naam" placeholder="Naam" class="inputtype" /><br />
<input type="text" name="email" placeholder="Email" class="inputtype" /><br />
<textarea name="bericht" placeholder="Bericht"></textarea>
<input type="reset" value="Reset" class="buttontype" />
<input type="submit" value="Verstuur" class="buttontype" />
</form>

PHP code:

<?php
$name = $_POST['naam'];
$email = $_POST['email'];
$message = $_POST['bericht'];

$to = "name@domain.com";
$subject = "Bericht van $name";
$headers = "From: $email \r\n";

mail($to,$subject,$message,$headers);

header('Location: http://www.newlocation.nl/');
?>

What am I doing wrong?

Paul van den Dool
  • 3,020
  • 3
  • 20
  • 44

1 Answers1

0

Try adding @ob_start(); after your opening <?php tag.

This turns on output buffering. I use it in combination with all header(...) redirects.

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134