I have written a custom module which creates a link on the page.
When you clicking the link
<a href="path_to_module/lib/script.php?lotOfparameters=value> Do it </a>
a php file is called, where all the logic of the module is done (create a node with predefined field values, create a pane for panels module and other stuff).
But i think this isn´t the recommend way to to this in Drupal. Doing this in the .php file is tooking sometimes a lot of time, so a progress bar would be nice for exmaple.
So I am looking for the best way to do logic when a button is clicked on the site.
EDIT: I think that was a bad description for my problem, so i try to make this better.
In my Templates, e.g. page.tpl.php and node.tpl.php, I´m printing a link to create a button. If the buttons gets clicked I want to do some stuff, i think what exactly is irrelevant. But I'm doing this with a direct link to a .php file in the link. In this .php file all things are executed. And I think THIS isnt the best way to do things in drupal.