code to get form data