我需要一份固定的联系人提交表格

时间:2015-01-22 17:41:10

标签: php jquery html forms twitter-bootstrap

好的,所以我有模态切换,这很容易使用bootstrap。但现在,每当我点击提交时,表单都会被重定向到php / contact-process.php。它看起来像PHP被处理,但然后只是停留在白色屏幕,而不是被重定向,并没有收到我的主电子邮件的电子邮件(我把example@gmail.com的stackexchange问​​题)。请帮我。

<!--Modals for Contact-->
<div class="modal fade" id="contact" role = "dialog">
<div class="modal-dialog">
  <div class="modal-content">

      <form class="form-horizontal contact" name="contact" action="php/contact-process.php">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4>Contact Us</h4>

      </div>
      <div class="modal-body">
        <div class="form-group">
          <label for="contact-name" class="col-lg-2 control-label">Name:</label>
          <div class="col-lg-10">
            <input type="text" name="name" class="form-control" id="contact-name" placeholder="Full Name">
          </div>
        </div>
        <div class="form-group">
          <label for="contact-email" class="col-lg-2 control-label">Email:</label>
          <div class="col-lg-10">
            <input type="email" name="email" class="form-control" id="contact-email" placeholder="you@example.com">
          </div>
        </div>
        <div class="form-group">
          <label for="contact-message" class="col-lg-2 control-label">Message:</label>
          <div class="col-lg-10">
            <textarea name="usertext" name="message" id=""  rows="8" class="form-control" style="resize:none;"></textarea>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <a href="#" class="btn btn-default" data-dismiss="modal">Close</a>
        <button class="btn btn-primary" type="submit" value="Send!">Send</button>
      </div>
    </form>
  </div>
  </div>
</div>

接触PROCESS.PHP:

<?php
//add the recipient's address here
$myemail = 'example@gmail.com';

//grab named inputs from html then post to #thanks
if (isset($_POST['name'])) {
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$message = strip_tags($_POST['message']);

//generate email and send!
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n ".
"Email: $email\n Message \n $message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email";
mail($to,$email_subject,$email_body,$headers);

//redirect
header("Location: index.php");

exit();
} 
?>

0 个答案:

没有答案