Best Practice for Server Processing

In a theme I have a form that I need posted and some work done on the server. What is the recommended way of doing this?

I have it posting to another php file where some work will be done, and then redirected back to the previous url. I'm having some issues with this because all the functions that normally work in a page don't anymore; such as home_url() and get_current_user_id(). Is there a good/easy way to include the basic WP things to use?

Does the php file need to be a wordpress page? Is this even a good way doing this?

-
Is this for wp-admin or the front-end? –  Brian Fegter Jul 21 '12 at 6:20
For the front end. –  Josh Close Jul 21 '12 at 6:32