我对 php 很陌生。如何将选定的下拉框值传递给下一页 url?我有这样的事情: -
<script language="javascript">
function showMe(str)
{
document.getElementById('myDiv').innerHTML = 'You have selected :'+str;
}
</script>
<select id="ccrseid" name="ccrseid" onchange="showMe(this.value);">
<option value="">Select</option>
<option value="1">Computer Science</option>
<option value="2">Engineering</option>
<option value="3">Business</option>
<option value="4">Education and Training</option>
</select>
<div id="myDiv"></div>
</body>
</html>
<a href="#"onclick="document.location.href='timer.php?selectvalue='+document.getElementById('myDiv').value">Submit</a>
当我执行时,我在 url 处得到“未定义”。
http://localhost/timer.php?selectvalue=undefined
我该如何解决这个问题?