implementing button functionality for adding material to db