Jump to content

Autocomplete Search bar


microbert

Recommended Posts

Hi,

 

I am trying to make an autocomplete search bar - so for example if  want to search for "Sony D3256 Camera" and I type "Sony camera" in the search bar, it still suggest the "Sony D3256 Camera".

 

The ones that I found on blogs and forums are the ones that shows the suggestion until you break the sequence of the name.

 

I am using PHP and MySQL

 

Is this possible, or cannot be done?

Link to comment
https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/
Share on other sites

Is this search bar being used to pinpoint an item in a dropdown or some other screen element or do you expect this to trigger an ajax request to hit the server with some kind of 'like' query?  The latter could be very cumbersome with a slow or unreliable connection, especially if you expect it to interpret your input value as your example showed, and not be just a straight auto-complete.

I wouldn't call it an "auto-complete" in that case.  IMHO, an auto-complete does its thing while still presenting the same page with only the proposed results(s) being modified.  To me it sounds like you want to regenerate the page after each character is typed which would be more time consuming than simply letting the user type in their search request.

I have to completely agree with ginerjm. Keep your code simple, more un-needed scripting not only uses up more of your time to create and diagnose but it also increases the loading time of each page. Depending on how much traffic your website is getting these little pieces of unneeded, heavy transfer code can bring even the mightiest of servers to their knees.

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.