Well your particulars are going to be more the deciding factor. But I will see if I can give you a bit more detail.
As you mentioned you can use the "onchange" event to run a javascript function.
<select id="myslect" name="myselect" onchange="GetdbInfo(this.options[this.selectedIndex].value)">
<option value="val1">Option 1
<option value="val2">Option 2
</select>
Then the "value" of each option can be passed to your PHP via the AJAX and your PHP can use that information to grab data from your database.
Now to send data back to the AJAX I would recommend you send it as XML. My reasoning is that if you are retrieving data from a database I suspect it will be more than just one or two pieces of information.
<?php
// database query
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
echo '<data>';
echo '<dataitem>' . $mydata . '</dataitem>';
echo '</data>';
?>
You can then use javascript to to parse the DOM of the XML and place the data into an input field.
if ((req.readyState == 4) && (req.status == 200)) {
var myresponse = req.responseXML.documentElement;
try {
document.getElementById('myinput').value = myresponse.getElementsByTagName('dataitem')[0].childNodes[0].nodeValue;
}
catch (error) {
document.getElementById('myerror').innerHTML = 'An Error Occurred';
}
}
That is all real generic and many particulars are missing but hope it gets you off the ground.
Should also note that there are tons of AJAX tutorials out there so I am sure you can find one that more directly address what you are doing.