How to add a function to web form submit button?
Your mileage will vary, but it's the same as adding submit handlers to any form:

function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'foo') {
    $form['actions']['submit']['#submit'][] = 'MYMODULE_some_function';
  }
}

function MYMODULE_some_function($form, &amp;$form_state) {
  // Do something...
}


See hook_form_alter() for full details.