Hello,
How about this for a different method:
The php that displays the form writes an extra hidden field to the
form, containing a random string value. It also writes that random
string along with a timestamp to a database table, called say,
form_control. The form action sends to a separate php
If its a potentially long message you're storing, you can always create an MD5
sum during insertion, compare it to existing MD5 sums, and if they don't
match, there's not duplicates.
Just as an example, if you're inserting message and user data, first see if
there's duplicates:
if (!mysql_num
Thanks!
I had already dealt with the problem using unique key, as many others
suggested. However, the records (post your comment-type) doesn't have any
natural key, so I had to concotinate several long text strings, which isn't
nice.
Could you point me in the direction of any code examples for
Ryan Grange wrote:
> How well would this methodology deal with people who double-click on
> submit buttons?
Of course, second submit generates second POST.
For browser history that looks like user clicks "Back" and then clicks
any other link on a page.
Everything else depends from your applic
Alexander Veremyev wrote:
You could use next simple rules to avoid this problem:
1. Never change anything in your storage (database) by GET HTTP
request method.
2. Never prepare any Web page by POST method.
3. After Form is processed (with a POST method) use HTTP redirect to
corresponding G
You could use next simple rules to avoid this problem:
1. Never change anything in your storage (database) by GET HTTP request
method.
2. Never prepare any Web page by POST method.
3. After Form is processed (with a POST method) use HTTP redirect to
corresponding GET page which should produce
after entering the data, send the user to another (confirmation) page...then
you avoid the possiblity of duplicates
Bastien
From: Miles Thompson <[EMAIL PROTECTED]>
To: "Hallvard" <[EMAIL PROTECTED]>, php-db@lists.php.net
Subject: Re: [PHP-DB] Duplicate record
Date: Sat
Do a seek on the fields which cannot be duplicated; if there's a
hit reload the page with the appropriate error message, otherwise reload
the page with a success message.
Although I have not worked with AJAX, this would appear to be an excellent
spot to use it. Silently check after focus h
in my opinion you can do the following:
1) once the user submitted the form, redirect to a new page
OR
2) may have a unique column in database to avoid duplication like userid
etc.
With Best Wishes
Balwant Singh
INDO ASIAN FUSEGEAR LTD.
A-39, HOSIERY COMPLEX
PHASE
p.net
Subject: [PHP-DB] Duplicate record
I have a page that posts data from a form to a mysql database.
The problem is that if the user hits the reload button on the browser, the
data will be posted again, resulting in a duplicate record.
How can I avoid that?
--
PHP Database Mailing List
I have a page that posts data from a form to a mysql database.
The problem is that if the user hits the reload button on the browser, the
data will be posted again, resulting in a duplicate record.
How can I avoid that?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit:
11 matches
Mail list logo