Results 1 to 4 of 4

Thread: [RESOLVED] search listing

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2009
    Posts
    156

    Resolved [RESOLVED] search listing

    How would I create a search box for an SQL database that could list or predict what I am searching for in much the same way google or other search engines list previous searches?

    So if I'm searching names and type 'te' a list of all the names that start 'te' eg technician technique etc shown below. Note that I have not submitted the form and I'm continuing to type the name.

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: search listing

    This has more to do with Javascript than PHP. I've not done this before myself, but I can tell you what I'd do...

    For anything complex in Javascript, I firstly recommend using jQuery, a framework that can make writing JS faster, easier and cross-browser compatible without having to write it 5 different ways. If you've never used it, take a look at their Tutorial page and read up a little first.

    Secondly, jQuery has a bunch of handy plugins already available. Here is the one you want: Autocomplete.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2009
    Posts
    156

    Re: search listing

    Thanks SambaNeko I'll give it a look

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] search listing

    JavaScript is used to send the text which is typed to the server using an XMLHttpRequest object. The server runs some script (perhaps executing an SQL query) to create the list of suggestions, which is sent back to the client in response. DOM (Document Object Model) manipulation is used to present the list of suggestions to the user.

    Collectively, this technique is usually referred to as 'Ajax' (Asynchronous JavaScript and XML). XML need not be the language spoken between client and server, however; you might choose to use JSON or even plain text instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width