Boostrap 4表单未过滤任何消息

时间:2019-05-05 08:50:16

标签: php forms bootstrap-4

我的boostrap 4表单没有发送任何消息,我已经在服务器上上传了index.php和contact.php文件,但没有任何响应。您能帮我发现问题吗?

具有简单表格的着陆页

<form id="#contacts" method="POST" class="form" role="form">
    <div class="row">
        <div class="col-md-6 form-group">
            <input class="form-control" id="name" name="name"
                   placeholder="Podaj swoje Imię i nazwisko" type="text" required/>
        </div>
        <div class="col-md-6 form-group">
            <input class="form-control" id="website" name="website"
                   placeholder="Adres strony www" type="text" required/>
        </div>
        <div class="col-md-6 form-group">
            <input class="form-control" id="telephone" name="telephone"
                   placeholder="Podaj swój numer telefonu" type="text" required/>
        </div>
        <div class="col-md-6 form-group">
            <input class="form-control" id="email" name="email"
                   placeholder="Podaj swój email" type="email" required/>
        </div>
    </div>
    <textarea class="form-control" id="message" name="message" placeholder="Twoja wiadomość"
              rows="4"></textarea>
    <br>
    <div class="row">
        <div class="col-md-12 form-group">
            <button class="btn btn-primary" type="submit">Wyślij</button>
        </div>
    </div>
</form>

contact.php

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$website = $_POST['website'];
$telephone = $_POST['telephone'];

$email_from = 'SEO';
$email_subject = 'Wiadomość kontaktowa z... '
$email_body = "Name: $name.\n".
              "Email: $email.\n".
              "Message: $message.\n";
              "Website: $website.\n";
              "Telephone: $telephone.\n";

$to = "biuro@of.pl";
$headers = "From: $email_from r\n";
$headers .= "Reply-To: $email r\n";

mail($to,$email-$email_subject,$email_body,$headers);

header("location: index.php");

?>

1 个答案:

答案 0 :(得分:0)

您的表格丢失了Action

<form id="#contacts" method="POST" class="form" role="form" action="contact.php">