I have some problems with sending an form to mail. I dont see why the screen becomes blank of going to the handler. I al so want to send and mail to the sender that the mail is recieved. (a lot off dutch in the strings, this will i edit later if you just make it english of not understanding dutch, thanks for helping). This code is in my html index.php:
<form action="assets/inc/handlerofferte.php" method="POST">
<div class="form-group">
<input type="text" name="naam" class="form-control" required="required" placeholder="Naam">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" required="required" placeholder="E-mail">
</div>
<div class="form-group">
<select class="form-control" name="onderwerp" placeholder="Voor">
<option value="" disabled selected>Betreft (selecteer)</option>
<option value="plaatsing">Plaatsing</option>
<option value="herstelling">Herstelling</option>
<option value="renovatie">Renovatie</option>
<option value="andere">Andere</option>
</select>
</div>
<div class="form-group">
<input class="form-control" name="meters" placeholder="Geschat aantal meters">
<br>
<textarea class="form-control" name="beschrijving" placeholder="Beschrijving"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-block btn-lg">AANVRAGEN</button>
</div>
</div>
</form>
My php handler is:
<?php
if(isset($_POST['submit'])){
$to = "info@webtex.be "; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$naam = $_POST['naam'];
$onderwerp = $_POST['onderwerp'];
$subject = "Aanvraag offerte";
$subject2 = "Bedankt voor uw aanvraag";
$message = $naam . " voor:" . $onderwerp . " Extra informatie" . "\n\n" . $_POST['bericht'];
$message2 = "Bedankt uw offerte aanvraag " . $naam . "\n\n" . $_POST['bericht'];
$headers = "Van:" . $from;
$headers2 = "Van:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $naam . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>