Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • autocomplete function with php

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 284
    Comment on it

    Jquery is a powerful library and it is heart of web develepment. It includes different types of functions.

    Today we are going to discuss function named autocomplete() which is useful to auto populate the suggestions as user types, filtering and searching. It is included in jquery ui api. We will take an example for auto complete. Please check the example below.

    $query = mysql_query("SELECT country_name from country_list");
    $country_arr = mysql_fetch_array($query);
    <link rel="stylesheet" href="//">
    <script src="//"></script>
    <script src="//"></script>
    var collect_list = <?php echo json_encode($country_arr); ?>;
    $( "#country_list" ).autocomplete({
    source: collect_list,
    select: function(event, ui) { 
    <div class="main">
    <form id="country_list_frm">
    <input type="text" name="country_list" id="country_list" />

    In above example, we are fetching list of countries details from database and passing it in the auto-complete function. It will populate the list of countries as user types in text field.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: