邮件表单php无法正常工作(空白屏幕)

时间:2016-10-09 12:33:35

标签: php

将表单发送到邮件时遇到一些问题。我不明白为什么屏幕变成了去处理程序的空白。我也想发送并邮寄给邮件收件人。 (在弦乐器中荷兰语很多,如果你只是让英语不懂荷兰语,我会稍后编辑,谢谢你的帮助)。 这段代码在我的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>

我的php处理程序是:

<?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.
    }
?>

0 个答案:

没有答案