vandris 0 Newbie Poster

HI!

I'm trying to make a form where a dropdown menu is populated from mysql.
My code:

<?
    $link = mysql_connect('localhost', '****', '****');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('****');
mysql_set_charset("utf8");
$query="SELECT distinct first_name FROM names_table";
$result=mysql_query($query);

?>
<select name="first_name" onChange="">
<option>Choose!</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option value=<? echo($row['first_name'])?>><? echo($row['first_name'])?></option>
<? } ?>
</select>
</select><br/>

now what i'm trying to do is using the onChange property of select
i want to populate a second drop down box (without reloading the page,i heard this is
achieved with ajax) depending on the value from the first box


now my problem is i could search for scripts (prewritten) but i do not know how to
do a php query inside javascript

could someone help me?

thanks in advance ,Andris