Jump to content

Username Search,


burnside

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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.