form validation and inserting into DB tables