top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Implementing setAutoComplete in PHP/JQuery

+2 votes

I am implementing a feature in QueryHome itself so thought what could be the best way to implement and found the best way could be to get the help people. Following is what I am trying to do -

  1. I have a form with multiple field (say 10 fields)
  2. For two fields I want to implement autocomplete feature.
  3. Once user enters 3 characters autocomplete should get hit after that on each character typed..
  4. A PHP function should be called which will set json_encode to populate the result.

Any pointer...

posted Oct 24, 2013 by Salil Agrawal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Following link looks useful

Here minlength can be set to 3
Thanks Pankaj, it should be helpful...
Yes it worked, would you like to put the content in more readable form for the benefit of People.

1 Answer

+1 vote
Best answer

PHP GUI Code where auto-complete function would be called

<script type="text/javascript"
<script type="text/javascript"
<link rel="stylesheet" type="text/css"
href="" />

<script type="text/javascript">
      <form method="post" action="">
                Name : <input type="text" id="name" name="name" />

Implementation of database interaction code



     $query=mysql_query("SELECT * FROM student where name like '%".$term."%' order by name ");

                'value'=> $student["name"],
                'label'=>$student["name"]." - ".$student["id"]

      echo json_encode($json);
answer Oct 26, 2013 by Pankaj Agarwal
Similar Questions
+1 vote

I use following code for jQuery.ajax to call php.


It seems that one php file only work for one jquery ajax code, Is it possible to have more than one function or one return different result in one php file?

Your help is greatly appreciated,

+1 vote

I have a POST form and action itself like following

I want to show success message when POST complete or error message if there is any. I would like to know are there any property or global variable I can check to show message to users. If not, it seems that the only solution is jQuery, since it has success function that jQuery call after POST.