Posted on 2009-05-13
Okey, so i got this php function retrieving information from a mysql table:
$sql = mysql_query("SELECT * FROM cast");
it returns a small table with columns CastId and Name.
And a search field:
echo "<input type=\"text\" name=\"searchCast\" value=\"Search here\">";
And a listbox to place the information.
echo "<select name=\"listbox\" size=\"10\" class=\"searchList\">";
So basically what i want is the listbox to view all the values in the box when the inputfield is empty (or showing the default value "Search here"). Then i want the listbox to filter its values based on input from the text from the inputfield.
0 Arnold Schwartznegger
1 Bruce Willis
2 Julia Roberts
3 Harrison Ford
4 Christian Bale
If someone types "b" in the inputfield, it will filter the listbox (with onchange() maybe?) so that the Names not containing the character "b" will dissapear. In this example then only nr 1,2 and 4 will be displayed.
If you having a hard time understand my problem, please specify it and i'll try explaining it further.