<select name="phonelist[]" id="phonelist" multiple="multiple" size="15" style="width:150px;">--php----$temp_x=$_POST['phonelist'];取到的永远是 <select>里面 selected 即被选中的值 其它值都没有?
<select name="phonelist[]" id="phonelist" multiple="multiple" size="15" style="width:150px;">--php----$temp_x=$_POST['phonelist'];取到的永远是 <select>里面 selected 即被选中的值 其它值都没有?
function select_all()
{
for(var i=0;i< document.getElementById("pholist").options.length;i++) {
var templist=document.getElementById("pholist");
templist[i].selected=true;
}
return true;
}给全部selected然后在php中
$temp_x=$_POST['pholist'];
for($i=0;$i<count($temp_x);$i++){
echo $temp_x[$i].",";
}就OK了
要是想选择多个,可以用checkbox啊。
<select name="phonelist[]" id="phonelist" select="selected"/><select name="phonelist[]" id="phonelist" select="selected"/><select name="phonelist[]" id="phonelist" select="selected"/><select name="phonelist[]" id="phonelist" select="selected"/><select name="phonelist[]" id="phonelist" select="selected"/>假如默认都为选中的也只能输出最后一个值