Filtering a database table

Hello everyone,
I’ve created a web form using form_for helper. Based on the values
entered, I want to display only the relevant entries in the table. Can
someone tell me how to do it???