PHP Autosuggest

 

PHP component ready to use to implement basic autosuggest feature.


After several requests I published this simple "PHP component", ready to use, to implement a search form with an autosuggest feature using PHP and MySQL. For all ajax beginners this is the most simple way to implement it (just with 8Kb) and the only thing you have to do is modify some parameters. Take a look at this post for all related infos.

http://3.bp.blogspot.com/_TqPdHmAEwTM/R9hsO9hRRdI/AAAAAAAABRA/dorPDMbLTuE/s400/autosuggest-component.png

 

 

 

 

 

 

 


http://1.bp.blogspot.com/_TqPdHmAEwTM/R6Ds89u3tkI/AAAAAAAAA0U/biqUma6R5w4/s400/tag_orange.png
 Download Autosuggest PHP component



Before to start
Before to start, take a look at content of package:

http://lh5.google.it/antonio.lupetti/R9hvo9hRReI/AAAAAAAABRI/bfaDhMqrVr8/autosuggest.png

 

 

 

 

 

 

 

 

 

In detail:

- autosuggest.php include a form to search something into your database.
- ajax_framework.js enables ajax functionalities
- search.php contains a standard query to looking for something into some DB table
- config.php includes DB connection parameters

Ok. Now?

Step 1: include autosuggest.php
Create a new PHP page (for example index.php) in the
 same folder (don't change it, ok?) where is autosuggest.php:

http://lh4.google.it/antonio.lupetti/R9hxZthRRgI/AAAAAAAABRY/g7t3zJlL_VY/autosuggest-2.png

 

 

 

 

Open index.php and include autosuggest.php where you want into the <body> tag:

<?php include('autosuggest.php')?>


...in this way you include the search form into your page.

Step 2: modify config.php
Change MySQL connection parameters in
 config.php:

http://lh4.google.it/antonio.lupetti/R9h5GthRRjI/AAAAAAAABR0/AP0Pfl2K2Ss/autosuggest-4.png


 

 

 

 

 

 

 

Step 3: modify query parameters
In
 search.php you have to modify some query parameters. Not fear, is very simple.
For example, image you use your autosuggest to find all books of a certain author and your database has a table (BOOK) with two attributes
 book_title, andbook_author. What do you have to do?
At
 line 23 you'll cange "USER" with the table you have, "BOOK" and at line 24"name" with book_author:

http://lh5.google.it/antonio.lupetti/R9h639hRRkI/AAAAAAAABR8/oQNUJpyyaE0/autosuggest-5.png

 

 

 

 

At line 43 change "NAME" with the attribute you want in output, in this case wih book_title.

Nothing else!

CSS customizing
If you want you can change the look of each autosuggest element modifying the CSS code into
 autosuggest.php:

http://lh4.google.it/antonio.lupetti/R9h1TthRRhI/AAAAAAAABRg/TAaSBkOcMSU/autosuggest-3.png

 

 

 

 

 

 

 

 

 

 

 

 

 

Download and test the component. If you have some problems tell me all you want.

http://1.bp.blogspot.com/_TqPdHmAEwTM/R6Ds89u3tkI/AAAAAAAAA0U/biqUma6R5w4/s400/tag_orange.png
 Download Autosuggest PHP component

 

 

 

 

New User?Register

Important Links

DOEACC Helpdesk

Download Sample C Language Programs

Interview Questions

Windows XP

Windows Vista

Windows 2000 Server

Windows Server 2003

Redhat Linux

Configure RAID in Linux

SUN Solaris

How To Install Sun Solaris

VMWARE

Microsoft Exchange Server

IBM Lotus Notes

C-Language

Java Script

PHP/MYSQL

c++

Desktops

Laptops

Servers

ThinClients

Printers

Terms Of Service
About Us | Site Map | Privacy Policy | Contact Us | Disclaimer

Best Viewed on 1024*768 Resolution