Forums

PHP

This topic is locked

problem with POST Values

Posted 15 Sep 2006 12:44:06
1
has voted
15 Sep 2006 12:44:06 ASif Iqbal posted:
Hello sir how r u today.
hope fine.

ok there is a problem please take a look.

server-model<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>hp

i have a page (register.php) with a form asking for name and address. i use to add the post data through the same page on the upper-section code like:-

&lt;?
if($_POST[submit]="ok"
{
//add Post value to database
}
//and then redirect to next page(thankyou.php)
header("location:thankyou.php";
?&gt;
now the problem is when i click back button of the browser , it generates one warning (" The page u r requesting containg post data and the any the code related to post data will be repeated"

something like this...
now when i press the ok button it takes me to back page that is "register.php" but it repeates the adding record to database again that was in post data...

so please help me what should i do. or please it would be better if u can tell me the reason that y it is all happening.

thank you sir. bye.


Replies

Replied 15 Sep 2006 14:24:49
15 Sep 2006 14:24:49 Roddy Dairion replied:
Well when you press back you post data is submitted again and it runs the same script. Try to put your script in another page, do the same action and press back you'll find out that you won't get the same error.
Replied 15 Sep 2006 14:38:29
15 Sep 2006 14:38:29 ASif Iqbal replied:
thank you for respoding me.

well it works but this is also the way that use post data in the same page.
is there any solution for this.

just asking for knowladge.

thank you.
Replied 15 Sep 2006 16:51:19
15 Sep 2006 16:51:19 Roddy Dairion replied:
Sorry i don't think there is, well not that i know of. You could try by checking if this data is present in the database if it is then escape and don't write it again.

Reply to this topic