title: Autocomplete TextBox using php
body: <p>I am doing autocomplete using PHP but I'm getting an error with the following code so please help me.</p>
  
  <p><strong>INDEX.PHP</strong></p>
  
  <p>this is my HTML code </p>
  
  <pre><code>&lt;form method="POST"&gt;
      &lt;input type="text" name="txtpname" id="txtpname" size="30" class="form-control" placeholder="Please Enter City or ZIP code"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>this is my script</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" /&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          $("#txtpname").autocomplete({
              source:'ajax_autocomplete_party.php',
              minLength:1
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>this is my ajax file from where i get data. <code>ajax_autocomplete_party.php</code>
  include "script/db.php";</p>
  
  <pre><code>$term=$_GET["txtpname"];
  
   $query=mysql_query("SELECT * FROM party_details where NAME like '%".$term."%' order by NAME");
   $json=array();
  
  while($party=mysql_fetch_array($query))
  {
      $json[]=array(
          'value'=&gt; $party["PARTY_ID"],
          'label'=&gt;$party["NAME"]
      );
  }
  
  echo json_encode($json);
  </code></pre>
  
  <p>I'm getting an error while my page reload error is: <code>autocomplete not defined</code> what to do now</p>