change options


#1

so I am trying to use this:

[code]
product
category

</select></td>
<script>
$('#cat').change(function() {
var options = '';
if($(this).val() == 'category') {
    options = '<select name="criteria"><?php $result = mysql_query("SELECT * FROM categories");

while($row = mysql_fetch_array($result))
{
$cat = $row[“category”];
?><?php echo $cat; ?><?php }
?>’;
}
else if ($(this).val() == ‘product’){
options = ‘’;
}

$('#ca').html(options);

});

[/code]

my goal is when the product is selected, a textbox hows, when category is selected a select menu shows. can anyone help?