funbinod Posted February 14, 2015 Share Posted February 14, 2015 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 More sharing options...
justsomeguy Posted February 16, 2015 Share Posted February 16, 2015 I'm sure it's possible, but if you're using jQuery and jQuery doesn't make it easy to do that then you'll probably need to write the autocomplete code yourself. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now