How to call a function on node submit in drupal 7
function MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) 
{
  //echo $form_id; // get the form id 
    switch($form_id)
    {
        case 'name_of_the_form': 
           $form['#submit'][] = 'test_form_submit';
           break;
    }
}

function test_form_submit($form, &amp;$form_state)
{
  drupal_set_message("How are you");
}