Hi guys
I made this simple comment system, where people could just write in their name and comment and leave a message that everyone can see.
I've got a form set up with the fields name and comment, and I have a text file to store all the past comments (not database!).
Anyway, my program opens this txt file with fopen() append, and writes to it with fputs(). The only problem is, whenever people refresh the page after they left the comment, the browser sends the typed info again to the form, and the comment appear again. Can you do something to prevent this? I'll appreciate any help.
thanks
A problem with my simple comment system
Moderator: General Moderators
-
tehhparadox
- Forum Newbie
- Posts: 18
- Joined: Thu Oct 01, 2009 11:55 am
Re: A problem with my simple comment system
You have to redirect the user with header('Location: ...') after he puts the comment, in order to dispatch the POST data, and to allow them to refresh without reposting.
-
tehhparadox
- Forum Newbie
- Posts: 18
- Joined: Thu Oct 01, 2009 11:55 am
Re: A problem with my simple comment system
Thanks Darhazer! you solved my problem.