..sending. Sorry, I couldn't fit the entire topic. Anyway...
I have a PHP form on my site. Anyway, everytime someone refreshes the page or presses back into the form it resends the information to the page. (It's post action is to itself.) Anyway, this is a BIG problem. Does anyone know how to make it so that it only submits the form when the user presses the send button?
Alternatively, I could also set all the values of the form to 0 after they submit, but I don't know how I would do that either.
Either would fix the problem, does anyone know how to do it?
Filling in forms with a PHP script/preventing accidental...
Moderator: General Moderators
-
SashaSlutsker
- Forum Newbie
- Posts: 18
- Joined: Sat Mar 20, 2004 11:24 am
use sessions
http://www.php.net/manual/en/ref.session.php
and set a value to the session and if that value is there dont show the form
i think that should help
http://www.php.net/manual/en/ref.session.php
and set a value to the session and if that value is there dont show the form
i think that should help
-
SashaSlutsker
- Forum Newbie
- Posts: 18
- Joined: Sat Mar 20, 2004 11:24 am
You can reset $_POST values. Just do $_POST['var'] = "". Then in your process script make sure you check that there are values to insert.
Alternatively if you are allowing your users to submit the form more than once, but they must enter new data each time, you could check the database to see if the data is the exact same that is already in there.
Alternatively if you are allowing your users to submit the form more than once, but they must enter new data each time, you could check the database to see if the data is the exact same that is already in there.