Building a forum - a php question

Hello, first of all, to all of you out in the server-side land. So… here’s the problem… I have a friend who is trying to build his very own forum in php. The problem is that when a user logs on to the forum, posts a message and then refreshes the page, the same message is posted again, by the script :). Also, when a user logs on to the forums, the user should be redirected to the same page he was viewing when he logged on.
Thanks to all and have a fun …