Javascript Bootstrap 3表格提交

Javascript Bootstrap 3表格提交,javascript,jquery,html,forms,twitter-bootstrap,Javascript,Jquery,Html,Forms,Twitter Bootstrap,我正在使用Bootstrap3构建一个联系人表单,我有以下问题:如果提交为空,表单将提交到同一页面。如果我在框中输入值,它将重定向到主页。只有在输入框使用name=“something”属性时,才会出现此问题。有人知道为什么吗?HTML是这样的: <form class="form" method="post" action="http://localhost/contact"> <div class="form-group">

我正在使用Bootstrap3构建一个联系人表单,我有以下问题:如果提交为空,表单将提交到同一页面。如果我在框中输入值,它将重定向到主页。只有在输入框使用name=“something”属性时,才会出现此问题。有人知道为什么吗?HTML是这样的:

      <form class="form" method="post" action="http://localhost/contact">
        <div class="form-group">
          <label for="name">Nume</label>
          <input type="text" name="name" class="form-control" id="name" placeholder="Numele tau...">
        </div>
        <div class="form-group">
          <label for="email">Adresa email</label>
          <input type="email" name="email" class="form-control" id="email" placeholder="Adresa email...">
        </div>
        <div class="form-group">
          <label for="subject">Subiect</label>
          <input type="text" name="subject" class="form-control" id="subject" placeholder="Subiectul mesajului...">
        </div>
        <div class="form-group">
          <label for="message">Mesaj</label>
          <textarea class="form-control" name="message" id="message" rows="5" placeholder="Mesajul tau aici..."></textarea>
        </div>
        <button type="submit" class="btn btn-default">Trimite mesajul!</button>
        </form>

努姆
Adresa电子邮件
子项
梅萨伊
特里米特梅萨朱尔!

您需要一个操作来实际提交表单。在您添加操作以处理表单并通过电子邮件发送之前,表单不会执行任何操作

<form class="form-horizontal" method="post" action="contactform.php">


我使用了这个表单的一个变体,

在表单标签中使用一个ACTION参数来控制目标:
我也添加了它,它指向正确的url,但它显示的是主页。需要注意的一点是:如果我删除name=“something”参数,它会工作。但是我需要它来与php一起使用…也许你提供了正确的数据,并且你的php在处理这些数据后将你重定向到你的主页。php是手工编写的,不可能发生这种情况。我还添加了这一点,它指向正确的url,但它显示的是主页。需要注意的一点是:如果我删除name=“something”参数,它就会工作。但是我需要它来与php一起使用…你创建了php页面吗?当然。我已经将此设计集成到wordpress主题中。您是否为该操作创建了php文件?i、 处理表单并发送电子邮件的e.form.php?是的。我在之前的评论中已经回答了这个问题。。。即使我没有创建一个,它也不应该默认为主页。我应该有一个404错误。