问题
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