Possible Duplicate:
How do I programatically set the value of a select box element using javascript?
I'm trying to update a table with the results of a query when a select option has changed. The following test code works fine. But when I try to update the query, it doesn't work. I'm guessing it has to do with the 'echo', but I cant get figure it out. Thanks.
<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;
?>
what doesn't work:
document.getElementById("country").innerHTML=value;
$country = '<p id="country">United States</p>'
$result = mysql_query("SELECT * FROM statistics WHERE (Country='$country')");
The result of that is a blank table when the page loads, I would have expected 'United States' to be the default value. And when I select something from the pulldown, it does nothing.