i am looking for Auto-Complete list email address on register page please tell me the code or plugin

Example site :https://www.banggood.com/login.html

Recommended Answers

I'm going to write "never do this." Why?

For your autocomplete to work, you would have to send over the list of email addresses to the user and that's a problem. Your site would them LEAK USER EMAIL ADDRESSES.

That won't be a good thing. For this round, …

Jump to Post

All 2 Replies

I'm going to write "never do this." Why?

For your autocomplete to work, you would have to send over the list of email addresses to the user and that's a problem. Your site would them LEAK USER EMAIL ADDRESSES.

That won't be a good thing. For this round, let the browser do its thing on autocomplete.

You can complete this task with typeahead.js library.

Bootstrap Typeahead

<input id="email_search" type="text" name="email_search" value="">

$('input#email_seach').typeahead({
    ajax: '/search_database_for_email.php'
    displayField: 'email',
    valueField: 'id',
    onSelect: function(item) {
    //This is used to populate a hidden field with the email id if returned.
      $('input[name="email_id"]').val(item.value);
    }
  });

On the backend, do a query to the database using a LIKE statement.

`SELECT * FROM email_list WHERE email LIKE %{filter_var($_POST["query"],FILTER_SANITIZE_STRING)}%`

Send your query results back as JSON object.

Warning: This code is not tested.. This is just to give you a starting point.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.