You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Fernando Munoz <fm...@lgecorp.com> on 2002/07/17 21:43:39 UTC
How to clean a POSTed variable
Is there a way to clean partially or totally the buffer with the variables
POSTed by a form. My problem is that every time the page is reloaded the
perl ASP script run again and add to a DB. I'm using a variable to determine
from where this page was called which a Request-> for their value and
depending on that I add some info to a DB. But if the browser is
"refresh/reloaded" the DB is updated again. Is it possible to change that
variable value after asking for it to avoid a reload to affect the DB
twice. Anyone has a workaround for this.
Thanks !
Fernando Munoz
___________________________________________________
Lions Gate Entertainment, Inc. [ AMEX: lgf ]
Five Proud Years, One Independent Spirit.
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: How to clean a POSTed variable
Posted by Josh Chamas <jo...@chamas.com>.
Fernando Munoz wrote:
> Is there a way to clean partially or totally the buffer with the variables
> POSTed by a form. My problem is that every time the page is reloaded the
> perl ASP script run again and add to a DB. I'm using a variable to determine
> from where this page was called which a Request-> for their value and
> depending on that I add some info to a DB. But if the browser is
> "refresh/reloaded" the DB is updated again. Is it possible to change that
> variable value after asking for it to avoid a reload to affect the DB
> twice. Anyone has a workaround for this.
>
The kind of trick I usually use to avoid the double-click
or reload effect is to do something like:
$Session->Lock;
unless($Session->{'trasaction_'.$transaction_id}++) {
# process transaction
}
$Session->UnLock;
You cannot really clean the POST buffer once the transaction
has occured because the browser is able to re-POST on its own.
Though if you found the right time to do so you clear the
current POST request data like
%{$Request->{Form}} = ();
I don't think you would ever do this, but I demo the command
should you ever want to. You could create some kind of fancy
transaction handler that automatically cleared the current
Form data given certain conditions for example.
--Josh
________________________________________________________________
Josh Chamas, Founder phone:714-625-4051
Chamas Enterprises Inc. http://www.chamas.com
NodeWorks Link Checking http://www.nodeworks.com
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org