一个好的程序员会写出完美的代码,一个伟大的程序员会使用完美的代码。
安装HTML_QuickForm:
$sudo pear install --onlyreqdeps HTML_QuickForm
auto_completion.php
<?php
require_once 'HTML/QuickForm.php';
// Create the array used for auto-completion
$teams = array('Steelers', 'Seahawks', 'Steel Curtains');
// Instantiate the HTML_QuickForm class
$form = new HTML_QuickForm();
// Create the autocomplete element
$element =& $form->addElement('autocomplete', 'teams',
'Favorite Football Team:');
// Map the array to the autocomplete field
$element->setOptions($teams);
// Dispaly the form
$form->display();
?>