使用javascript将下拉选择选项传递给url,它工作正常,但问题是现在<option>Select</option>
也传递给url,我怎么能 <option>Select</option>
在将选择选项值传递给url时禁用?我只想将名称发送到网址,除了<option>Select</option>
?
function getComboC(sel) {
var name=document.getElementById("name");
var input_val = document.getElementById("name").value;
name.action = "searchexpense.php?name="+input_val+"";
name.submit();
<form name="name" id="name"><select class="select10"
name="pname" id="name" style="width:150px;" onChange="getComboC(this)">
<option value="0"><--Select--> </option>
<?php
$query=mysql_query("SELECT pname from expenses order by id");
while($row=mysql_fetch_assoc($query))
{
$val2=$row['pname'];
?>
<option value="<?=$val2;?>" <? if ($_GET['pname'] == $val2)
{ echo "selected='selected'"; }?> >
<?=$row['pname'];?>
</option>
<?php }?>
</select></form>
URL While Select <option>Select</option>
searchexpense.php?pname=0
动态选项选择
searchexpense.php?pname=Test