error checking

adding a bit of error checking before submitting the form.