Question: I research in google and stack overflow for this answer there are lot of answer but i cannot able to get what i want.

I have two drop down menus and three text boxes.

PHP Code :

```
    <select onchange="FirstDropDownClick()"> </select>

```

script code : 

```
            <script type="text/javascript">
           function FirstDropDownClick() {

var selectDwn = document.getElementById("ID_dwn");
var selectedValue = selectDwn.options[selectBox.selectedIndex].value;

                 }

```

In "FirstDropDownClick()" i want the codes for the following :

1.select data from database according to the selected value.

2.Fill the text boxes with that.

3.Fill second drop down according to value of first drop-down menu.

I need an example codes. Because am stuck , dont know how to do .

Thanks in Advance.

Answer: 
If you want to do it with ajax and php
HTML

```
<select name="select_number" id="select_number">
    <option value="1">Number1</option>
    <option value="2">Number2</option>
    <option value="3">Number3</option>
</select>
<input type="text" name="number_value" id="number_value">

```

JQuery

```
$(document).ready(function(){
    $('#select_number').change(function(){
        var number_value = $(this).val();
        $.ajax({
            method: 'POST',
            url: "test.php",
            data: {
                'number_value' : number_value
            },
            dataType:'json',
            success: callback = function(data, textStatus, xhr)
            {
                $('#number_value').val(data.number_value);
            }
        });

    });
});

```

php (test.php)

```
<?php
echo json_encode($_POST);
?>

```
why you need php for that you can do it only with jquery or javascript

HTML

```
<select name="select_number" id="select_number">
    <option value="1">Number1</option>
    <option value="2">Number2</option>
    <option value="3">Number3</option>
</select>
<input type="text" name="number_value" id="number_value">

```

Jquery

```
$(document).ready(function(){
    $('#select_number').change(function(){
      var number_value = $(this).val();
      $('#number_value').val(number_value);
    });
});

```