[PHP] no-resubmit on reload/refresh

2001-03-06 Thread Bruin, Bolke de


I have a form which is submitted by a POST action.

After submitting, the same page (updated though) returns
with the form. (It's a messageboard)

Now when someone refreshes/reloads the page they get the
question if they want to resubmit the form.
I don't want that. You get double posts this way.

I know it is possible to check the input for any duplicates,
but for example this guestbook http://pub.alxnet.com/guestbook?id=120611

(hope the id works) does it differently and your browser does
NOT if you wnat to resubmit, it just doesn't do it.

Anyone knows how this works (HTTP header maybe?)

cheerz
Bolke



RE: [PHP] no-resubmit on reload/refresh

2001-03-06 Thread Jon Haworth

Javascript? (I know it's generally horrible, but it's good for this sort of
thing)

Stick this in your head.../head:

  script language="JavaScript" type="text/javascript"!--Begin
  var submitcount=0;
  function jsCheck() {
  if (submitcount == 0) {
 submitcount++;
 return true;
  } else {
 alert("This request has already been submitted, please wait
while it is processed.");
 return false;
  }
  }
  //End--/script

And call it from your form like this:

form name="myform" action="whatever" method="post" onSubmit="return
jsCheck()"

Voila.

HTH
Jon



-Original Message-
From: Bruin, Bolke de [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2001 12:53
To: [EMAIL PROTECTED]
Subject: [PHP] no-resubmit on reload/refresh



I have a form which is submitted by a POST action.

After submitting, the same page (updated though) returns
with the form. (It's a messageboard)

Now when someone refreshes/reloads the page they get the
question if they want to resubmit the form.
I don't want that. You get double posts this way.

I know it is possible to check the input for any duplicates,
but for example this guestbook http://pub.alxnet.com/guestbook?id=120611

(hope the id works) does it differently and your browser does
NOT if you wnat to resubmit, it just doesn't do it.

Anyone knows how this works (HTTP header maybe?)

cheerz
Bolke


**
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] no-resubmit on reload/refresh

2001-03-06 Thread Bruin, Bolke de

That's not really what I want

http://pub.alxnet.com/guestbook?id=200

(this one works)

does it without. 

On my page I am using a child window to reload the parent window
, so your solution can't be used unfortunately.

Bolke

-Oorspronkelijk bericht-
Van: Jon Haworth [mailto:[EMAIL PROTECTED]]
Verzonden: Tuesday, March 06, 2001 2:01 PM
Aan: Bruin, Bolke de; [EMAIL PROTECTED]
Onderwerp: RE: [PHP] no-resubmit on reload/refresh


Javascript? (I know it's generally horrible, but it's good for this sort of
thing)

Stick this in your head.../head:

  script language="JavaScript" type="text/javascript"!--Begin
  var submitcount=0;
  function jsCheck() {
  if (submitcount == 0) {
 submitcount++;
 return true;
  } else {
 alert("This request has already been submitted, please wait
while it is processed.");
 return false;
  }
  }
  //End--/script

And call it from your form like this:

form name="myform" action="whatever" method="post" onSubmit="return
jsCheck()"

Voila.

HTH
Jon



-Original Message-
From: Bruin, Bolke de [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2001 12:53
To: [EMAIL PROTECTED]
Subject: [PHP] no-resubmit on reload/refresh



I have a form which is submitted by a POST action.

After submitting, the same page (updated though) returns
with the form. (It's a messageboard)

Now when someone refreshes/reloads the page they get the
question if they want to resubmit the form.
I don't want that. You get double posts this way.

I know it is possible to check the input for any duplicates,
but for example this guestbook http://pub.alxnet.com/guestbook?id=120611

(hope the id works) does it differently and your browser does
NOT if you wnat to resubmit, it just doesn't do it.

Anyone knows how this works (HTTP header maybe?)

cheerz
Bolke


**
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP] no-resubmit on reload/refresh

2001-03-06 Thread Jørg V . Bryne

Well, I've had the same problems with an "Send SMS" routine and it caused
the message to get sent twice or more if the user refreshed.

I fixed this by adding the following logic:

If there are post-data, put this into a session variable (an array of
key=val) and reload the page.
if there are no post-data put the session-variable array into the current
scope again using a foreach loop, and then delete the session variable, so
data won't be processed again.  Works like a charm, and doesn't include
javascript. Don't know if it's excactly right for you, so you might have to
modify it a bit.

(From memory only, might be typo's:)

snip
?
session_start();
session_register( pre_posted );

if (count( $HTTP_POST_VARS)=1) {
 foreach( $HTTP_POST_VARS as $k=$v ) {
  $pre_posted[$k] = $v;
 }
 header( "Location: $PHP_SELF" );
 exit;
} elseif ( is_array( $pre_posted )) {
 foreach( $pre_posted as $k=$v ) {
$$k = $v;
 }
 unset( $pre_posted );
}

echo "bYou posted: $Test/bbrWant to refresh?";
?

form method=post
input name='Test' value='test' size=20
input type=submit
/form

/snip
- Original Message -
From: "Bruin, Bolke de" [EMAIL PROTECTED]
To: "'Jon Haworth'" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, March 06, 2001 2:29 PM
Subject: RE: [PHP] no-resubmit on reload/refresh


 That's not really what I want

 http://pub.alxnet.com/guestbook?id=200

 (this one works)

 does it without.

 On my page I am using a child window to reload the parent window
 , so your solution can't be used unfortunately.

 Bolke

 -Oorspronkelijk bericht-
 Van: Jon Haworth [mailto:[EMAIL PROTECTED]]
 Verzonden: Tuesday, March 06, 2001 2:01 PM
 Aan: Bruin, Bolke de; [EMAIL PROTECTED]
 Onderwerp: RE: [PHP] no-resubmit on reload/refresh


 Javascript? (I know it's generally horrible, but it's good for this sort
of
 thing)

 Stick this in your head.../head:

   script language="JavaScript" type="text/javascript"!--Begin
   var submitcount=0;
   function jsCheck() {
   if (submitcount == 0) {
  submitcount++;
  return true;
   } else {
  alert("This request has already been submitted, please wait
 while it is processed.");
  return false;
   }
   }
   //End--/script

 And call it from your form like this:

 form name="myform" action="whatever" method="post" onSubmit="return
 jsCheck()"

 Voila.

 HTH
 Jon



 -Original Message-
 From: Bruin, Bolke de [mailto:[EMAIL PROTECTED]]
 Sent: 06 March 2001 12:53
 To: [EMAIL PROTECTED]
 Subject: [PHP] no-resubmit on reload/refresh



 I have a form which is submitted by a POST action.

 After submitting, the same page (updated though) returns
 with the form. (It's a messageboard)

 Now when someone refreshes/reloads the page they get the
 question if they want to resubmit the form.
 I don't want that. You get double posts this way.

 I know it is possible to check the input for any duplicates,
 but for example this guestbook http://pub.alxnet.com/guestbook?id=120611

 (hope the id works) does it differently and your browser does
 NOT if you wnat to resubmit, it just doesn't do it.

 Anyone knows how this works (HTTP header maybe?)

 cheerz
 Bolke


 **
 'The information included in this Email is of a confidential nature and is
 intended only for the addressee. If you are not the intended addressee,
 any disclosure, copying or distribution by you is prohibited and may be
 unlawful. Disclosure to any party other than the addressee, whether
 inadvertent or otherwise is not intended to waive privilege or
 confidentiality'

 **

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]