提交后的联系表格登录页面

时间:2018-11-15 13:40:17

标签: php html html5

我需要一些帮助来理解为什么提交表单后无法使表单返回index.html页面。该表格可以正常工作,并且可以通过电子邮件发送邮件,但是一旦提交,网站就会转到错误页面(找不到文件,错误404)。

<!-- begin snippet: js hide: false console: true babel: false -->
<?php
    $name = $_POST ['name'];
    $vistor_email = $_POST['email'];

    $email_from = 'enquires@emergencyplumbers247.com';

    $email_subject = "newsletter submission";

    $email_body = "User Name: $name.\n".
                    "User Email: $vistor_email.\n";

    $to = "newsletter@emergencyplumbers247.com";

    $headers = "From: $email_from \r\n";

    $headers .= "Reply-To:$vistor_email \r\n";

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

    header("Location: index.html")
?>

这是我使用的PHP。我已将标头位置更改为index.html,但不高兴将其返回到index.html页。

<!-- Newsletter -->

<section>
  <div class="container text-center">
    <div class="newsletter mt-3 mb-3 p-4">
      <form id="contact-form" method="post" action="./php/contact-form-handler.php">
        <h5>Sign up to our newsletter</h5>
        <p>Recieve the lastest news and offers by signing up today.</p>
        <div class="form-group text-center">
          <label for="input-name" class="sr-only">Your Name:</label>
          <input type="text" name="name" class="form-control text-center" placeholder="full name" id="input-name" required>
        </div>
        <div class="form-group text-center">
          <label for="input-email" class="sr-only">Your Email:</label>
          <input type="email" name="email" class="form-control text-center" placeholder="mail@example.com" id="input-email" required>
        </div>
        <div class="form-check">
          <label class="form-check-label">
              <input type="checkbox" class="form-check-input" id="input-terms" value="terms">
              I have read and accept the <a href="#" data-toggle="modal" data-target="#modal"> terms and conditions.</a>
            </label>
        </div>
        <div>
          <small class="form-text">You can unsubscribe from the mailing list at anytime</small>
          <button type="submit" class="m-1 btn btn-light">SIGN UP</button>
        </div>
      </form>
      <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modalTitle" aria-hidden="true">
        <div class="modal-dialog modal-lg" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title" id="modalTitle">Terms and Conditions</h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="close">
                    <span aria-hidden="true">&times;</span>
                  </button>
            </div>
            <div class="modal-body">
              <p> Emergency Plumbers 24-7 do not sell or forward any personal information, we use highly reliable And stable service which is protected by the latest technology. We are unable like every other company to protect your information 100%, but
                we take this very seriously and have every form of protection in place to ensure all areas are covered and protected to our best ability.
              </p>
              <p> The only information we hold is your email and name, this is forward on only back to you or our system administrators for the marketing of our own products, offers and services. Under no circumstances would we ever give or use your details
                for third-party companies.
              </p>
              <p> Should you wish for your details to be removed from our system simple send an email to unsubscribe@emergencyplumbers247.com, This process may take up to 48 hours. We promise not to spam and to only share information and offers that will
                benefit our customers.
              </p>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-dismiss="modal">close</button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>


<!-- NEWSLETTER END-->

0 个答案:

没有答案