The feature that you are trying to build is called autocomplete.
You will need to write a PHP script (assuming that you are writing a pure PHP based web application) which takes input the typed string in the input box and fire a SQL 'LIKE' query on your database tables and return the list of matched results.
On the user interface with every keystroke event, you need to make an ajax call which will invoke the aforementioned PHP script and fetch the list of names. You can now display that list in a drop down or there are lot of plugin in jQuery UI which will create this component for you.
Note: Using LIKE query for autocompleting the strings can be costly if your table contains thousands of rows. If performance is an issue here as well then look into Apache Solr or Elasticsearch to index your data and provide more sophisticated autocomplete results. In that case, instead of the database, you have to query these engines and get the results.
However, if you are not dealing with high volume of data you can still work with LIKE query.