How to display some data from a database, based on an input from the user?

I am creating a website for an organisation which aggregates students of various colleges. They will register using the custom registration form and login to the site. I want to create a page on my site, where the student will type in their email ID, and get the contact details of their college student representative. How do I create a system for this? The student inputs the email ID, which matches it with the name of the college. Now I can create another database with College name and the student representative details. How do I link all of this, so that, when a student enters the email ID in an input field on my page and clicks a button, they will see the contact details?