Re[5]: [PHP-WIN] Preventing multiple submits

From: Date: Fri, 25 Aug 2000 14:39:48 +0000
Subject: Re[5]: [PHP-WIN] Preventing multiple submits
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-2150@lists.php.net to get a copy of this message
Zak: You are COMPLETELY RIGHT !, I did some checking and by registering a variable (with session_register), it will keep its value from script to script. I only have one problem, when the user submitts a second form, the browser will cancel the first connection. The first script will run normally, but its output (confirmation, error, etc.) will not reach the browser. The user will only see whatever the second script sends. If there was an error in the first one, he won't know. How do you solve this ? Saludos, Pablo Vera _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Thursday, August 24, 2000, 5:22:08 PM, you wrote: ZG> At 05:11 PM 8/24/00 -0500, Pablo Vera wrote: >>[snip] >>Zak: >> >>I think that the "if (! $post_counter)" will always result in a true >>condition, this is because the only ways to preserve a variable from >>instance to instance of a script is by sending them in the URL or by >>setting a cookie, but since the form is being submitted twice from >>exactly the same page, you will have two scripts running at the same >>time, with exactly the same variables and values, and the output of >>the first one will not be received by the browser, because the second >>one canceled that connection. You will end up processing two forms, >>but the user will receive confirmation for only one. ZG> The $post_counter variable is not stored client side. All that you store ZG> client side is a session id in either a cookie or as get/post data. ZG> The $post_counter variable is tracked server side by PHP's session manager. ZG> (You could also use another mechanism, if desired.) ZG> - zak

« previous php.windows (#2150) next »