I'm currently having the same problem, but I've found a quick fix for it.
maybe it will be appropriate for what your doing.
First, I consider it to be bad code to have more than one page process form
data, so this example will incorporate just one page called FORM.PHP. i'll
use a small example that ask for your name.
when the page loads, you want your PHP code to check for two things: 1) is
this the first load of the page? or has it been POSTED using the submit
button? 2) is the $_POST['firstname'] variable already set? (click here for
info on predefined variables:
now in order for them not to be able to repost the data you have to clear
the value of the variable. There are a few ways to do this, but i like
after you post the data when the SUBMIT button is pressed, you'll use unset
to clear the value of the. You can see that if the variable is empty, then
the if statement will not allow for the data to be reposted. see below for
a snippet of code. if the IF statement isnt satisfied, then the form will
show. the only way for them to resubmit the data would be to fill out the
if ($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST['firstname']))
//sql code to submit data to database.
unset($_POST['firstname']; //clear variables after data has been posted
//here you can redirect to another page upon successful posting
<form method=post action=form.php> //notice how form references itself
<input type=textfield name=firstname>
<input type=submit name=submit value=submit>
"Wista.Pl" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello group,
> I need a good solution to prevent sending form data to server after hiting
> refresh. How can PHP know that user hit refresh and sent data that
> have been stored in database (without querying database)?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php