Hello,
Shown below is the sample code, amended for my DB to autocomplete a combobox.
The combo box will not load the option correctly when you have an ‘&’ character in the field. It will work if there is a space.
Example :
‘A&’ - truncates to ‘A’
‘A &’ - shows proper options
I am calling the combo like this:
var z=dhtmlXComboFromSelect(“label”);
z.enableFilteringMode(true,“labelSuggest.php”,true);
labelSuggest.php:
header(“Content-type:text/xml”);
print("<?xml version=\"1.0\"?>");
$link = mysql_pconnect(“xx”, “xx”, “xx”);
$db = mysql_select_db (“xx”);
if (!isset($_GET[“pos”])) $_GET[“pos”]=0;
$sql = “Select * from tblLabel”;
$res = mysql_query ($sql);
getDataFromDB($_GET[“mask”]);
mysql_close($link);
function getDataFromDB($mask){
$sql = “SELECT DISTINCT label FROM tblLabel Where label like
'”.mysql_real_escape_string($mask)."%’";
$sql.= " Order By label LIMIT “. $_GET[“pos”].”,20";
if ( $_GET[“pos”]==0)
print("");
else
print("");
$res = mysql_query ($sql);
if($res){
while($row=mysql_fetch_array($res)){
$thisLbl = $row[‘label’];
print("");
print “”;
print("");
}
}else{
echo mysql_errno().": “.mysql_error().” at “.LINE.” line in
“.FILE.” file
";
}
print("");
}
Hello,
try to use A& instead of A&. For example:
Thanks!
I used the htmlspecialchars() php function…
and that solved it!