Jump to content

Username Search,


Recommended Posts

Hey all, i have a question but not sure if its a php question or not, Anyway here goes,

 

i have a text box, i was just curious how would i do it so if you started to type something in it a username for example, it would bring i list of all the username starting with the first letter of the work, for example,

 

3 users, Adam, Andy, Chris

 

so if i type A in the text box Adam & Andy will populate a drop down box?

 

sorry if you cant understand what im trying to say, i think you tube does it when your searching on there site,

 

 

Also sorry if in wrong forum.

Link to comment
https://forums.phpfreaks.com/topic/107750-username-search/
Share on other sites

The front end (the text box) would need to use javascript and you could write a simple php script for the backed (have it perform a mysql query for WHERE username LIKE '$input%' (remember to use mysql_escape_string on $input, though).

 

your textbox would need to fire an ajax request to the php script on its OnChange event and then parse the returned results (you could use json or xml, or even simply CSV) and list these results in a drop down menu below the text box.

 

There are pre-made scripts about on the net though to save you the hassle...

 

http://www.dhtmlx.com/docs/products/dhtmlxCombo/index.shtml

 

Link to comment
https://forums.phpfreaks.com/topic/107750-username-search/#findComment-552364
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.