Page 1 of 1

Problem with "Backing"

Posted: Fri Oct 15, 2004 5:34 am
by harrisonad
Hello

i am an intermediate user of php, yet some things still bug my codes since i first started:

when processing mysql query, i tend to separate the HTML form with the processing php page. then after executing the query(either adding new record or update it), i would redirect to another separate HTML page just for 'sucess message'.

the problem is, when the user "backs" (that is to click on the back button of a browser so as to retain previous page), the query executes again, resulting from "duplicate error" on mysql.

can anyone help me with this.

thanks in advance.

Posted: Fri Oct 15, 2004 6:13 am
by twigletmac
Do you use a header redirect to the success page (i.e. using [php_man]header()[/php_man])?

Mac

Posted: Fri Oct 15, 2004 6:24 am
by harrisonad
yes,

here it is:
header("location: message.html");

go on, tell me what's on you mind...

Posted: Fri Oct 15, 2004 6:49 am
by twigletmac
Just eliminating one potential problem with the header question :)

Think I know how to solve this: put the processing code into a separate file from the display code, then the submit button takes you to the processing page which redirects you to the success page. Pressing the back button from the success page takes you to the display page.

Mac