Get customer information from the database after selecting the drop-down list using php / ajax


i'm trying to make a simple webpage for making invoices. to select/load customer info i'm using a select dropdown filled with all the customers in the database. after selecting a customer i want php to get all the values of that customer from the database and echo somewhere else on the page. thought it would be something simple but tried everything and cant seem to get it to work.

any help?

after deleting all the code that didn't work anyway this is what i'm left with:

<select name="selectCustomer">
    <option selected>Klantnaam</option>
        $result = mysql_query('SELECT * FROM '.$c_tbl_name);

        while($row = mysql_fetch_array($result)) {
            echo    '<option value="'.$row['c_id'].'">';
            echo        $row['c_name'];
            echo    '</option>';

You need some small AJAX function to do that:

        $('#result').load('load_data_from_db.php', {
            customer : $(this).val();

You than need a script load_data_from_db.php which takes the selected customer, generates the content and returns it to the client where it would be placed into an element with the ID result.