Page 1 of 1

refresh while submitting page

Posted: Tue Feb 16, 2010 9:06 pm
by khoemf
HI all

I am new in this forum.

I have a question is that there is a page "actionA.php" which take time to do lot of thing (e.g get a file list form master table, checking each file exist, then copy one by one ,more that 1000 file and write a record to DB for that user). While processing, some user refresh the page , as a result there are duplicate /wrong record (file list) for the user. How can i avoid user to refresh the page while submitting page (in client level or server level). I have studied about "Post Redirect Get Pattern" but it seems not work.

Thanks All

Re: refresh while submitting page

Posted: Tue Feb 16, 2010 9:42 pm
by jraede
You can use session variables. Just set something like $_SESSION['user_ran_script'] to TRUE after the script executes, and then on the first line do a conditional to see if that variable is set.