|
-
Jul 3rd, 2009, 08:11 AM
#1
Thread Starter
Addicted Member
[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.
-
Jul 3rd, 2009, 11:30 AM
#2
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.
-
Jul 6th, 2009, 03:31 AM
#3
Thread Starter
Addicted Member
Re: search listing
Thanks SambaNeko I'll give it a look
-
Jul 6th, 2009, 10:17 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|