Added function to save user input and keywords to database