Problems integrating an ajax livesearch function

01-02-06, 09:17 AM
|
|
Newbie Coder
|
|
Join Date: Jul 2003
Location: South Africa
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problems integrating an ajax livesearch function
Hi
I'm trying to integrate a livesearch function for my website. I had a look at bitflux's livesearch, and google suggest, but could not get either of them working on my site.
What I would like to accomplish is as follows:
I have a DB table with users, and want to do a search on 4 fields, id, firstname, middlename, lastname, and then return those fields to a form, which has quite a bit of form fields. Thus, I want to display firstname, middlename and lastname in three different form fields, and have the id field as a hidden form field.
Can someone please direct me into the right direction as I'm pulling my hair out, and need to get this up and running ASAP.
Your help, suggestions, and samples will be HIGHLY appreciated 
|

01-02-06, 11:17 AM
|
|
Wannabe Coder
|
|
Join Date: Oct 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is what I do when I have a lot of fields to fill in.
This is the code you would put on the page you want to search from.
Last edited by ben.periton; 01-02-06 at 11:29 AM.
|

01-02-06, 11:23 AM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

01-02-06, 12:47 PM
|
|
Newbie Coder
|
|
Join Date: Jul 2003
Location: South Africa
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by XTech
This is what I do when I have a lot of fields to fill in.
This is the code you would put on the page you want to search from.
|
This is *not quite* what I'm looking for. I want to do a search of users from a DB.
Put differently, I have a form, which adds relatives to existing users. I want it to query a MySQL DB, fetching the following fields: id, firstname, middlename and lastname; and then pass it to the form, which has a few more fields, which the user / operator needs to fill in, and then submit. The important thing that needs to happen is that the id field needs to be passed to the form as a hidden field, something like:
Nevermind, the tutorial you suggested is great, but it doesn't do what I'm looking for either. Any other suggestions?
|

01-02-06, 05:02 PM
|
|
Wannabe Coder
|
|
Join Date: Oct 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This would search a mysqlDB. It just needs to be modified.
This was just an example of how it uses an array. Instead of that, you would do your mysql query then put the info into an array.
If you replace the line below:
then do your mysql query using $_GET['search'] (which contains the id) in the query, then simply put the results into an array and pass it to phpArrayToJsArray().
This creates the array of data to use in the javascript.
|

01-03-06, 02:53 AM
|
|
Newbie Coder
|
|
Join Date: Jul 2003
Location: South Africa
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Unresolved......
Hi XTech
Thank you for your help. This is unfortunattely not what I'm looking for. With the Google suggest, it drops down a list of options, in a DIV tag, with possible suggestions, as you type. And then when you find something that you want to use, you can either click on it, or select it with the keyboard. I tried to implement their code into my site, but for some odd reason, which I don't know why, it just doesn't work, and it doesn't seem like it's configured for error reporting, thus I don't know what to modify / fix. On it's own, the script works fine, but not with my site (which is on a LAN, and usses sessions)
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|