Go to previous page (not after form submit) I have a function that is called by hook-menu item an is accesible from different subpages of the site. This function does not return any html, it just do some database inserts and should redirect user back where he came from. 

Well, it could be easily done by adding url args as a parameters to this function and then use drupal_goto() with those arguments. But I'm wondering if there is any drupal function for this. I was trying drupal_goto(drupal_get_destination()); but it does nothing.
Create your link this way:

$link = l('Link title', 'your/menu/path', array('query' =&gt; drupal_get_destination));


This will add the destination argument to the link URL.

Then, at the end of your page callback, simply call:

drupal_goto();