Multiple auto-complete field with different values

I have two fields

<input type="text" id="user-name" />
<input type="text" id="admin-name" />

 $("#user-name").autocomplete("autocomplete.php", {
        selectFirst: true

I’m using single php file handle autocomplete .i.e autocomplete.php

    $mysqli=mysqli_connect('localhost','root','','test') or die("Database Error");
    $sql="SELECT user_name FROM users WHERE user_name LIKE '%$my_data%' ORDER BY user_name";
    $result = mysqli_query($mysqli,$sql) or die(mysqli_error());

            echo $row['user_name']."\n";

I’m getting the expected output for username, but how to do same for admin-name with the same php file. as default autocomplete.php will fetch username only, how to make it to act different

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.