realisticp
12-12-2009, 04:32 AM
I have a table containing three fields Name, city, Marks
If I select name filed in dropdownlist box I want the rest of the fields to be displayed in Text boxes.
Btcc22
12-12-2009, 06:21 PM
You could do this pretty easily in PHP if you can tolerate a page refresh, but if you're not then you'd need a Javascript solution.
I'd give you a Javascript solution for this, but it'd probably be wrong. ;)
mattle
12-14-2009, 12:27 PM
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.