Code Analysis
require ‘HTML/QuickForm.php’;
If PEAR is enabled in localhost then it will include the QuickForm.php file which has classes to generate Quickform.
$teams = array(‘Amit’,’Satyan’,’Saswat’,’Chinmoya’,
‘Sonali’,’Kiran’,’Ansuman’,’Hemendra’);
Storing the names in the $teams array to autopopulate, Means we have to generate the array from which we will show the matches in the textbox.
$form = new HTML_QuickForm();
creating an object of HTML_QuickForm class which is defined inQuickForm.php
$element =& $form -> addElement(‘autocomplete’,’teams’,’Favorite Engg Team:’);
addElement is a function in HTML_QuickForm class first parameter is the type of functionality we need , second one is the textbox name and third one is the label name. Remember, we are creating the autocomplete element here.
$element -> setOptions($teams);
Here we are mapping the array to the autocomplete field (teams)
$form->display();
by using the display function we are displaying the form
i hope it workd on your local or server if not you have to check the PEAR enable and if needed install PEAR class
Steps
First we will have to install the php-pear module on the server. This can be done using yum.
yum install php-pear*
We must also configure pear in php config at /etc/php.ini.
include_path=”.:/usr/share/pear:/local/PEAR/” [ check your include_path in php_info() ]
Restart apache on the server.