[PHP] Stopping the dreaded refresh

Soldato
Joined
18 Oct 2002
Posts
7,635
Location
Sutton Coldfield, Birmingham
I have a form which once submitted, sends the data to the same page and is handled by an if statement.

However, if that person then refreshes the page, the data is submitted again, even though the form could be blank.

How can I get around this? I can't use sessions, are there any alternatives to using cookies?
 
Dj_Jestar said:
Generate an id field before the form is submitted and store it in a hidden field in the form, then validate the id before allowing submission of the form.

Thats a good idea and I have just tried that but whenever the form is submitted, a new random ID is generated and so it doesn't work :confused:
 
Back
Top Bottom