Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP autocomplete in text box?

Status
Not open for further replies.

jmreinwald

Technical User
Jun 3, 2002
46
US
I currently have a MySQL database full of hockey cards. I'm creating searchability for player names, and I want to be able to begin typing in a player name and have possible matches (of the player name only) appear as I type. From there I will pass along the value and search the appropriate field.

I envision it as having a text box to type into, and a multiple option box (perhaps?) where the "matches" appear. I believe the best way is to gather the unique names from a MySQL query, which is fine, but where do I go from there?
 
Ahh, just found some somewhat simple javascript autocomplete tidbits.

I suppose I'll try filling the possible values on the fly from a MySQL query. Should be interesting. I don't want to have to deal with manually editing an array or list if I don't have to!
 
try using AJAX(prototype,scriptaculous) it has autocompleting
 
google "google suggest clone". the example is php, mysql, and would fit in nicely for you.

i used it in my last project.
 
if you don't want the dynamic client-server interaction of Ajax then you might take a look at the PEAR class HTML_QuickForm. this has an autocomplete element which takes an array as an argument. it sorts out all the javascript for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top