Actually, you probably want both...AJAX (JavaScript) on the client-side capturing the onChange() event in the select box, which instantiates a call to a PHP-script which performs your DB query and returns HTML to redraw the other text boxes, or simply the text to use, if you can find a reasonable delimiter. Your AJAX function will then capture the response from the PHP script and update the page with the new values.
It's easier than it all sounds

Google "PHP AJAX Tutorials". For starting out, I'd also recommend you look at jQuery to manage the AJAX functionality...much easier than brewing your own function.