beansandsausages Posted May 29, 2008 Share Posted May 29, 2008 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 More sharing options...
PromaneX Posted May 29, 2008 Share Posted May 29, 2008 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 More sharing options...
beansandsausages Posted May 29, 2008 Author Share Posted May 29, 2008 ill give that site ago, you got any other examples? Link to comment https://forums.phpfreaks.com/topic/107750-username-search/#findComment-552403 Share on other sites More sharing options...
PromaneX Posted May 29, 2008 Share Posted May 29, 2008 Depending on how far you want to take it you could use extjs , but it may be a little heavy for what you want http://extjs.com/deploy/dev/examples/form/combos.html Link to comment https://forums.phpfreaks.com/topic/107750-username-search/#findComment-552466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.