此表单不提交帖子值

时间:2016-12-27 10:47:53

标签: html forms twitter-bootstrap-form

当提交以下引导程序表单时,我在服务器端获取空值数组:

<form id="target" action="/Insert_Room" method="post" class="form-horizontal form-label-left" novalidate>
        <div class="form-group">
          <label class="control-label col-md-3 col-sm-3 col-xs-12">Room-Name</label>
          <div class="col-md-9 col-sm-9 col-xs-12">
            <input type="text" class="form-control" placeholder="202-A/C-AttachBath">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-md-3 col-sm-3 col-xs-12">Room-Prize</label>
          <div class="col-md-9 col-sm-9 col-xs-12">
            <input type="text" class="form-control" placeholder="Prize...">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-md-3 col-sm-3 col-xs-12">Comments</label>
          <div class="col-md-9 col-sm-9 col-xs-12">
              <textarea class="form-control" rows="3" placeholder='Room Comments'></textarea>
          </div>
        </div>
        <div class="form-group">
          <div class="col-md-6 col-md-offset-3">
            <button type="submit" class="btn btn-primary">Cancel</button>
            <button id="send" type="submit" class="btn btn-success">Submit</button>
          </div>
        </div>
      </form>

1 个答案:

答案 0 :(得分:0)

正如我所看到的,您没有将**name**属性赋予任何输入标记或textarea。必须为每个输入标记和textareas提供**name**属性以提交值并在提交的页面上获取这些值。

所以只需添加**name**属性,如下所示:

<input type="text" name="name" /> //you can add other attributes also

请记住:name属性必须是唯一的。