0
我填充的選擇下拉菜單中使用PHP如何從我的選擇人口稠密獲取文本值與PHP
<select name="course" onchange="tester()">
<option>Select Course</option>
<?php $result= mysql_query('SELECT DISTINCT Course FROM tasks'); ?>
<?php while($row= mysql_fetch_assoc($result)) { ?>
<option value="<?php echo htmlspecialchars($row['Course']);?>">
<?php echo htmlspecialchars($row['Course']); ?>
</option>
<?php }
?>
</select>
MySQL數據上的變化由tester()
功能打印
<script type="text/javascript" >
function tester()
{
var testMe = $('#course option:selected').text()
alert(testMe);
}
</script>
到我收到警報:
"The page at localhost says: undefined"