Book Image

PHP Ajax Cookbook

Book Image

PHP Ajax Cookbook

Overview of this book

Table of Contents (16 chapters)
PHP Ajax Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating Autocomplete from a database


Most of the time, users are sick of filling up forms. However, from the website's point of view, user input is very important for data mining and better service. When the end user has the ability to fill up forms quickly, or fill up forms easily, it will help both end users and the website owners. Autocomplete is one such attempt to help end users. Overall, we have two types of Autocomplete designs:

  • Within the browser UI, by allowing the browser to remember certain form inputs

  • Within websites that employ the Autocomplete technique to quickly fill up forms

In this recipe, we'll see how to integrate the jQuery UI Autocomplete plugin in a PHP script.

Getting ready

We'll require the jQuery UI from http://jqueryui.com/, with the Autocomplete component. Note that the jQuery UI download page, http://jqueryui.com/download, has a wizard-like interface to select the necessary files easily.

Regarding the database, we'll need to have a table with the schema jslibs (id...