Added Form submission logic and database calls