Jump to content

jquery ui autocomplete


funbinod

Recommended Posts

i'm trying jquery autocomplete using following----

<script>$(function() {	$( "#icode" ).autocomplete({		source: "icode.php"	});});</script>

and the icode.php is-----

<?phprequire_once('functions.php');$q = strtolower(mysqli_real_escape_string($connect, $_REQUEST["term"]));$return = array();$query = mysqli_query($connect, "SELECT icode, item, sprice, pprice FROM stock WHERE icode LIKE '$q%' AND cid='$cid' ORDER BY icode") or die("Error: ".mysqli_error($connect));while ($row = mysqli_fetch_array($query)) {	array_push($return,array('value'=>$row['icode'].':'.$row['item'].':'.$row['pprice'].':'.$row['sprice']));}echo(json_encode($return));?>

everything is fine. the autocomplete list displays all the information that is collected in the icode.php page.

 

what I wish additional is that the autocomplete list display all the information but when user select from the list, only the "$row['icode']" should be selected.

 

possible?

 

thanks in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...