form validation and database insertion commited