Error class not being set on form fields
The easiest thing to do, would be to save the form data in the validation step if the form has errors.

function form_validate(&amp;$form, &amp;$form_state) {
  // Validate
  if (form_get_errors()) {
    // This code is only run if the form has errors.
    // Save the form data
    db_query("...");
  }
}


Then you could raise the errors and let drupal do it's thing, and use the submit function for it's intended use: handle valid form data.

If you need to process the data this can be done in the validation step as well, as the info in the $form_state array will be carried to the form submit handler.