Bootstrap Select plugin - how to submit the form with it?

可紊 提交于 2020-02-04 10:56:08

问题


I'm trying to use Bootstrap Select plugin for a form I'm building. But the values selected don't get submitted into $_POST. Anybody has any experience with this Bootstrap plugin? Thanks in advance.


回答1:


These links might be helpful for get the post values of select input:

http://www.html-form-guide.com/php-form/php-form-select.html

http://www.formget.com/php-select-option-and-php-radio-button/

Generally bootstrap select input is as follows:

<div class="form-group">
  <label for="sel1">Select list:</label>
  <select class="form-control" id="sel1">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
  </select>
</div>

Here name attribute is not specified in bootstrap select input, so you have to add name attribute to post the selected value of select list.

<div class="form-group">
      <label for="sel1">Select list:</label>
      <select class="form-control" id="sel1" name="Color">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
      </select>
    </div>


来源:https://stackoverflow.com/questions/27216187/bootstrap-select-plugin-how-to-submit-the-form-with-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!