Generally, an autocomplete system needs three different technologies:
- Server-side language capable of providing data to the client: We will use PHP.
- Database to store data: To make our code as simple as possible we're going to use a file to store our data, but you can use a real database if you wish to.
The principle is simple but effective: when a user type a character in the text field, a search is done and the results are sent back to the navigator. The latter displays these results in a little frame located under the search field.We can then browse the results using the up and down arrow keys or the mouse cursor.If we choose one of the listed results, it will be automatically displayed instead of what was written by the user.