I'm trying to update a table with the results of a query when a select option has changed. 以下测试代码工作正常。但是当我尝试更新查询时,它不起作用。我猜它与“回声”有关,但我无法弄清楚。谢谢。
<script type="text/javascript">
function ChangeText(value)
{
document.getElementById("p1").innerHTML=value;
}
</script>
<select onchange="ChangeText(value)">
<option value="ONE">one</option>
<option value="TWO">two</option>
<option value="THREE">three</option>
<option value="FOUR">four</option>
</select>
<?php
$variable1 = '<p id="p1">place holder</p>';
echo $variable1;
?>
什么不起作用:
document.getElementById("country").innerHTML=value;
$country = '<p id="country">United States</p>'
$result = mysql_query("SELECT * FROM statistics WHERE (Country='$country')");
结果是页面加载时出现空白表,我原以为“美国”是默认值。当我从下拉菜单中选择某些东西时,它什么也不做。