CGI - unreloadable page?

R

Roman Khutkyy

Hi all.
There is a problem (i hope so). When i submit the form first time, the
script put fields data into database. But when on next page i make "Reload"
this process repeats again, and the same record are being placed. How to
disallow this. I mean, how to make the new page withot any parameter in
address string?
 
G

Gunnar Hjalmarsson

Roman said:
When i submit the form first time, the script put fields data into
database. But when on next page i make "Reload" this process
repeats again, and the same record are being placed. How to
disallow this. I mean, how to make the new page withot any
parameter in address string?

Note that this is not a Perl language question, so you are not at the
right place.

Anyway, if the parameters appear in the address bar, the form was
submitted using the GET method. To avoid that, you can use the POST
method.

That does not prevent the data to be resubmitted if you make a
"Reload", but I believe that browsers typically ask before
resubmitting form data.

HTH
 
B

Brian Wakem

Hi all.
There is a problem (i hope so). When i submit the form first time, the
script put fields data into database. But when on next page i make "Reload"
this process repeats again, and the same record are being placed. How to
disallow this. I mean, how to make the new page withot any parameter in
address string?


POST the data to a scripts that does whatever processing you require and
then redirect the user to another page. If they then reload that page
there wont be any parameters to re-send and it will be a different page
anyway.

use CGI;
print $query->redirect($url);
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all.
There is a problem (i hope so). When i submit the form first time, the
script put fields data into database. But when on next page i make
"Reload" this process repeats again, and the same record are being
placed. How to disallow this. I mean, how to make the new page withot
any parameter in address string?

Not really a Perl question, but hey.

The usual method is to include a unique identifier string as a hidden
field in the submission. The receiving page can query the database to
see if that unique string has been submitted already; if so, scold the
user for double-clicking. :)

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP7QPyWPeouIeTNHoEQJpFACg1wzF5HuMgqAcDe10o5cLjxc7xBUAn1tq
CBCgnvIro3P0jr7MiGxsj7Lf
=SAf/
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top