|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello
I use a POST variable named "status" to show different screens while keeping everything in the same script. The problem is that in the Print screen, I need to empty this variable so the user doesn't get FireFox's familiar ""The page you are trying to view contains POSTDATA" if he hits F5/Refresh. Neither unset() nor setting the variable to nothing works: ========== switch ($_POST['status']) { default: //Main screen echo "<form method=post><input type=submit name=status value=Print></form>"; break; case "Print": //SELECT, etc. //To avoid FireFox's "The page you are trying to view contains POSTDATA" if user hits F5 //Doesn't work unset($_POST['status']); //Doesn't work $_POST['status']=""; break; } ========== Is there a way to remove this variable or set it to nothing, so that the user is redirected to default, main screen? Thank you. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Tue, 12 Feb 2008 12:34:00 +0100, Gilles Ganault <nospam@nospam.com>
wrote: > Hello > > I use a POST variable named "status" to show different screens while > keeping everything in the same script. > > The problem is that in the Print screen, I need to empty this variable > so the user doesn't get FireFox's familiar ""The page you are trying > to view contains POSTDATA" if he hits F5/Refresh. > > Neither unset() nor setting the variable to nothing works: > > ========== > switch ($_POST['status']) { > default: > //Main screen > echo "<form method=post><input type=submit name=status > value=Print></form>"; > break; > > case "Print": > //SELECT, etc. > > //To avoid FireFox's "The page you are trying to view contains > POSTDATA" if user hits F5 > > //Doesn't work unset($_POST['status']); > //Doesn't work $_POST['status']=""; > break; > } > ========== > > Is there a way to remove this variable or set it to nothing, so that > the user is redirected to default, main screen? Default flow for emptying POST/not having to deal with 'send postdata again?' messages: 1. Set up the form to post to a script almost solely dedicated to process that (or also other) forms. 2. Process the form, do actions, perhaps store some data in a session. 3. Instead of output/a page, send the user a header() redirect (header('Location: http://example.com/thankyou') for instance. 4. The UA/browser of the user goes to the page desired, with a GET request, so will receive no prompt on reload. Possibly show some variables from the session if the user has to be informed of something/has requested custom data. -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Tue, 12 Feb 2008 12:47:10 +0100, "Rik Wasmus"
<luiheidsgoeroe@hotmail.com> wrote: >Default flow for emptying POST/not having to deal with 'send postdata >again?' messages: Thanks for the tip, but apparently, there's no way to use POST to pass data (I'd rather keep the URL clean of any variable). Header() will return the user to the main page. And I'd prefer to keep all the code in a single file/page, hence the use of "status" to know where I am. Too bad, but it was just a minor thing. I asked just in case there were a way to keep the user in the Print page while removing FFox's page. Thanks. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Tue, 12 Feb 2008 14:00:14 +0100, Gilles Ganault <nospam@nospam.com>
wrote: > On Tue, 12 Feb 2008 12:47:10 +0100, "Rik Wasmus" > <luiheidsgoeroe@hotmail.com> wrote: >> Default flow for emptying POST/not having to deal with 'send postdata >> again?' messages: > > Thanks for the tip, but apparently, there's no way to use POST to pass > data (I'd rather keep the URL clean of any variable). Header() will > return the user to the main page. And I'd prefer to keep all the code > in a single file/page, hence the use of "status" to know where I am. > > Too bad, but it was just a minor thing. I asked just in case there > were a way to keep the user in the Print page while removing FFox's > page. It is perfectly possible, just start a session, store variables in it on a post, display (and possibly unset session variables) depending on variables available in the session. There's no good reason a page can't redirect to itself. -- Rik Wasmus |
|
![]() |
| Outils de la discussion | |
|
|