added form validation and error message code for pages 3 and 6