Q:

ajax php sql populate dependent comboboxes

I'm just a beginner for all this php ajax things. I populate one of my combobox from database but I can't populate second one.
I need to populate Machine combobox according to Proses value.
And finally fill Envanter no with Id. 
Thanks for help!
Here is my code
My database table main
Process |  Machine |   ID
Bolzen  |    M1    |    1
Bolzen  |     M2   |    2
Bolzen  |     M3   |    3
Platte  |    M4    |    5
Platte  |    M4    |    7
Here is my code
<html>
<body>
<div id="content"  style="background-color:#EEEEEE;position:absolute; overflow:hidden; left:138px; top:101px; width:770px; height:450px">
 <form action="" name="myform" id="myform">
  <p><center> MFT1.2 SPC Girisleri Ölcüm Programi</center></p>
    <center><p> Tarih:&nbsp&nbsp <span id="mydate"> </span>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <script type="text/javascript">
    date();
    </script>
    Machine No:
    <select name="Machine">
        <option value="000" selected = "selected"></option>

            </select>           
    </center></p>

    <center><p>
    Vardiya:&nbsp&nbsp
        <select name="Vardiya">
            <option value="000" selected="selected" >
            </option>
            <option>
              1. Vardiya
            </option>
            <option>
              2. Vardiya
            </option>
            <option>
              3. Vardiya
            </option>
        </select>   
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp            
    Envanter No:
    <input type="text" name="envanter" disabled="disabled"/>
    </center></p>
    <center><p>

    Proses:&nbsp&nbsp

            <?php
        // Load field datas into List box

            $cn=mysql_connect("localhost","root","12345678") or die("Note: " . mysql_error());
            $res=mysql_select_db("OlcumTakip",$cn) or die("Note: " . mysql_error());
            $res=mysql_query("select DISTINCT Proses from main;") or die("Note: " . mysql_error());
            ?>
        <select name="Proses">
            <option value="000" selected = "selected"></option> 
        <?php
        while($ri = mysql_fetch_array($res))
        {
        echo "<option value=" .$ri['Proses'] . ">" . $ri['Proses'] . "</option>";
        }
        echo "</select> ";

        mysql_close($cn);
        ?>      

    </center></p>
    <input type="submit" value="Submit" style ="margin-left:350px"/>
 </form>
</div>
</body>
</html>

A:

I suggest you use Jquery to make the ajax request, it's more easy. To know how the proccess should be, you can read the examples in posts below:
http://www.snilesh.com/resources/jquery/jquery-dynamic-selectbox/
http://www.codingcereal.com/2009/09/autopopulate-select-dropdown-box-using-jquery/
I hope that guides can help you.

