how to establish a connection after validating all the fields in a form can any one please help me with code