在我从文本框中输入类别时,它将检索子类别,但我的问题是只显示子类别的一个值,因为我在这里使用文本box.how我可以显示列表中的每个数据或类似的东西 那个on.please可以帮助我吗?
我的add_sales.php文件
<?php include_once("init.php");
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="lib/auto/css/jquery.autocomplete.css">
<?php include_once("tpl/common_js.php"); ?>
<script src="lib/auto/js/jquery.autocomplete.js "></script>
<script type="text/javascript">
$(function() {
$("#item").autocomplete("stock.php", {
width: 160,
autoFill: true,
mustMatch: true,
selectFirst: true
});
$("#item").blur(function()
{
$.post('check_item_details.php', {stock_name1: $(this).val() },
function(data){
$("#itemselect").val(data.itemselect);
}, 'json');
});
});
</script>
</head>
<body>
<form name="form1" method="post" id="form1" action="">
<table class="form" >
<tr>
<td>Item:</td>
<td>product select</td>
</tr>
<tr>
<td>
<input name="item" type="text" id="item" maxlength="200" class="round default-width-input " style="width: 150px" /></td>
<td><input name="itemselect" type="text" id="itemselect" maxlength="200" class="round default-width-input " style="width: 150px"/></td>
</tr>
</table>
</form>
</body>
</html>
&#13;
<?php
include_once("init.php");
$line = $db->queryUniqueObject("SELECT * FROM category INNER JOIN subcategory ON category.cat_id = subcategory.cat_id WHERE category ='".$_POST['stock_name1']."'");
$cname=$line->subcategory;
if($line!=NULL)
{
$arr = array ("itemselect"=>"$cname");
$arr1=
echo json_encode($arr);
}
else
{
$arr1 = array ("no"=>"no");
echo json_encode($arr1);
}
?>
&#13;