Question: Hope someone can help me.. 
i made my program more simpler so that everybody will understand..
i want my program to get the value of the without submitting, i know that this can only be done by javascript or jquery so I use the onChange, but what I want is when i select an option the value should be passed immediately on the same page but using php..

```
<select id="id_select" name="name" onChange="name_click()">
<option value="1">one</option>
<option value="2">two</option>
</select>

<script>
function name_click(){
value_select = document.getElementById("id_select").value;
}
</script>

```

and then i should pass the value\_select into php in post method.. i dont know how i will do it.. please help me..

Answer: 
You cannot do this using PHP without submitting the page. PHP code executes on the server **before** the page is rendered in the browser. When a user then performs any action on the page (e.g. selects an item in a dropdown list), there is no PHP any more. The only way you can get this code into PHP is by submitting the page.

What you *can* do however is use javascript to get the value - and then fire off an AJAX request to a php script passing the selected value and then deal with the results, e.g.

```
$(document).ready(function() {
    $('#my_select').on('change', do_something);
});

function do_something() {
    var selected = $('#my_select').val();
    $.ajax({
        url:        '/you/php/script.php',
        type:       'POST',
        dataType:   'json',
        data:       { value: selected },
        success:    function(data) {
            $('#some_div').html(data);
        }
    });
}

```

With this code, whenever the selected option changes in the dropdown, a POST request will be fired off to your php script, passing the selected value to it. Then the returned HTML will be set into the div with ID `some_div`.
Post with ajax as Alex G was telling you (+1) and then handle the post with PHP. You can define a callback in Javascript which will run when the page responds.