Creating A Search With Input Field

I am trying to figure out how to do a search that will lookup what a user enter into an input field. I want it to search a field in the database and if the text entered is found, I want to load the next page and pass the input text to the next page. But if it’s not found, I want it to display a message that the search did not find a match and to remain on the same page.