im trying populate a select based in other select, when im trying do the tutorial works perfectly
i have this code in the header
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".country").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "ajax_city.php",
data: dataString,
cache: false,
success: function(html)
{
$(".city").html(html);
}
});
});
});
</script>
and in the body
<div style="margin:80px">
<label>Country :</label> <select name="country" class="country">
<option selected="selected">--Select Country--</option>
<?php
$sql=mysql_query("SELECT * FROM master_cat_wine");
while($row=mysql_fetch_array($sql))
{
$id=$row['id'];
$data=$row['nome'];
echo '<option value="'.$id.'">'.$data.'</option>';
} ?>
</select> <br/><br/>
<label>City :</label> <select name="city" class="city">
<option selected="selected">--Select City--</option>
</select>
</div>
but when im trying create a form with a table to organize lhe layout don't work, im using this code in the body and the same header
<form action="#" method="post">
<table width="717" border="0">
<tr><td>
<select name="country" id="country">
<option selected="selected">--Select City--</option>
<?php
$result = mysql_query("SELECT * FROM master_cat_wine");
while ($row = mysql_fetch_array($result)){
echo '<option value="' .$row['id'].'">'.$row['nome'].'</option>';}?>
</select>
</td></tr>
<tr><td class="fontR">
<div align="right">Sub-Category</div></td><td>
<select name="city" id="city">
<option selected="selected">--Select City--</option>
</select>
</td></tr></table></form>
how i can access to the values inside a table inside a form?