When they click on the "login" link, you make a note of what page they were on, either by appending it to the URL via a query string or by using sessions. Then once they have logged in, your login script uses header() to send them to that page they came from.
Bookmarks