basically the concept of prg is to avoid the double submit problem
We could use three php files for that by making a separate files for data input, process and confirmation.
for example:
1). first page is a form with a single text area where user could input data. this page also specifies what page should be called next.
2.) the page called will not be shown to the user, this page retrieves user input from the first page, tries to connect to the database and would eventually try to insert the data specified by the user. After its work is done, it will try to call the third page. probably will call the third page with the header() function?
3.) the third page gives confirmation to the user that the data is successfully entered. this page is only a front end so people can't reprocess when they try to refresh the browser.
am i missing something?
also...
what is the use of this?
header('HTTP/1.1 303 See Other');
PRG in a nutshell - a clarification
Moderator: General Moderators
-
urboyfriend
- Forum Newbie
- Posts: 11
- Joined: Tue Sep 06, 2011 6:29 pm
PRG in a nutshell - a clarification
Last edited by urboyfriend on Fri Sep 09, 2011 8:40 am, edited 2 times in total.
Re: PRG in a nutshell - a clarification
The workflow you wrote above doesn't prevent from pressing twice the submit button, but only prevents from refreshing the page after the form which can cause the form to be resubmitted.
You can use javascript to disable the submit button after the first click.
You can use javascript to disable the submit button after the first click.
-
urboyfriend
- Forum Newbie
- Posts: 11
- Joined: Tue Sep 06, 2011 6:29 pm
Re: PRG in a nutshell - a clarification
thank you for the reply
so does this means the workflow i stated doesn't satisfy the prg technique?
so does this means the workflow i stated doesn't satisfy the prg technique?
Re: PRG in a nutshell - a clarification
Well, the workflow you stated is PRG (Post/Redirect/Get), however, PRG is not sufficient in order to prevent double form submit...