title: jQuery autocomplete not able to fetch data with php
body: <p>Here I'm implementing a shopping application. Using autocomplete for searching a product is not working. Here is the whole code.</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>    &lt;form class="navbar-form navbar-left" action="search.php"&gt;
                      &lt;div class="input-group" style="width: 650px;padding-left:150px; "&gt;
                          &lt;input type="text" class="form-control" placeholder="Search Product Here..." name="search_text" id="search"&gt;
                          &lt;div class="input-group-btn"&gt;
                              &lt;button class="btn btn-default" type="submit"&gt;
                                  &lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt;
                              &lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
      &lt;/form&gt;
  &lt;script&gt;
              $(document).ready(function(){
                  $('#search').autocomplete({
                      source : 'search_text.php',
                      minLength : 1,
                      autoFocus : true
  
                  });
              });
  &lt;/script&gt;
  </code></pre>
  
  <p>For fetching data from database
  <strong>search_text.php</strong></p>
  
  <pre><code>&lt;?php
  
  include 'db.php';
  
  if (isset($_GET['search_text'])) {
  
      $sql = "select * from product where product_name like  '%$_GET[search_text]%'";
      $result = mysqli_query($conn, $sql);
      if (mysqli_num_rows($result) &gt; 0) {
          $array = array();
          while( $row = mysqli_fetch_assoc($result)) {
              $array[] = array( 'label' =&gt; $row['product_name'] , 'value' =&gt; $row['product_id'] );
          }
          echo json_encode ($array);
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>Can anyone help me to find why it is not working?</p>