【发布时间】:2012-04-01 03:45:44
【问题描述】:
我正在创建一个简单的表单,我希望在此表单中具有自动完成功能。 http://www.script-tutorials.com/autocomplete-with-php-jquery-mysql-and-xml/我阅读了本教程,并为我的数据创建了一个具有以下格式的 XML 文件,
<inputs>
<input>AA</input>
<input>BAC</input>
<input>AWT</input>
<input>tag</input>
<input>AHY</input>
</inputs>
处理自动完成的方法是
$aValues = $aIndexes = array();
$sFileData = file_get_contents('data2.xml'); // reading file content
$oXmlParser = xml_parser_create('UTF-8');
xml_parse_into_struct($oXmlParser, $sFileData, $aValues, $aIndexes);
xml_parser_free( $oXmlParser );
$aTagIndexes = $aIndexes['ITEM'];
if (count($aTagIndexes) <= 0) exit;
foreach($aTagIndexes as $iTagIndex) {
$sValue = $aValues[$iTagIndex]['value'];
if (strpos($sValue, $sParam) !== false) {
echo $sValue . "\n";
}
}
break;
但问题是,当我在字段中输入时,它总是提示小写的数据。例如,如果我输入“A”或“a”,它只会提示数据“标签”
这是什么问题,我该如何解决?
谢谢。
【问题讨论】:
标签: php autocomplete