Auto Complete Text Field in PHP
by Victor | September 19, 2008 in Javascript, PHP | 2 Comments
On a web page form, one method to accept user input is with a single line text field. This allows for a visitor the freedom to input anything. But what if you want to give the visitor a set of options to choose from in addition to the freedom of inputting anything? That is what is commonly known as a auto complete text field. As a visitor types into the auto complete text field, a list of selectable options (similar to a drop down list) will appear. This method is similar, but not the same as a Combo Box.
The best way to create an auto complete text field is with JavaScript. There are many various websites out on the internet that offer an solution. My personal favorite script to use is one created by zichun called Auto Complete Control. Of the many controls I tries, I like this for the following reasons:
- It is free and use and download licensed under the Creative Common License
- It is easy to implement only requiring adding two JavaScript scrips
- Allows for many auto complete text field instances per page, each with many editable tweaks
- The auto complete options quickly appear as the visitor types
The JavaScript files can be downloaded as a single zip file from their official website at http://www.codeproject.com/KB/scripting/jsactb.aspx. As of the writing of this tutorial, the two required files are common.js and actb.js. [More]




