从多选中发布值 [英] Post values from a multiple select
本文介绍了从多选中发布值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从表单中的多个选择中发布值?
How can I post values from a multiple select in a form? When I hit submit none of the selected values are posted.
<form id="form" action="" method="post">
<div>
<select id="inscompSelected" multiple="multiple" class="lstSelected">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input type="submit" value="submit">
</div>
</form>
推荐答案
您需要添加 name
属性,因为它是一个多重选择,所以最后需要数组符号 []
。
You need to add a name
attribute and since it's a multiple select you need the array symbol []
at the end.
<select name="something[]" id="inscompSelected" multiple="multiple" class="lstSelected">
这篇关于从多选中发布值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文