RE: [PHP] Form duplicate post problem
| From: | John W. Holmes | Date: | Sun, 29 Dec 2002 16:16:13 +0000 |
| Subject: | RE: [PHP] Form duplicate post problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129585@lists.php.net to get a copy of this message | ||
> >You can still use one page and use a "middle-man" technique. The part
> >that processes the form input would redirect back to itself after the
> >data is inserted into the database, thus getting rid of the post
data.
> >So subsequent refreshes of the page will refresh without attempting
to
> >repost the data.
>
> This post is merely for reference and, hopefully, to help out
> some
> other person that runs into the same problem.
>
> I solved my duplicate form post problem using that middle-man
> technique you guys mentioned, but i did it in a little more user
friendly
> way than using a complete page and redirecting back to the original.
(thus
> preventing some design problems on my specific site)
>
> I used some javascript to open a small window, it has the
code to
> insert the comment into the database, thanks for the user input and
> immediately closes and refreshes the original, showing that last
inserted
> comment. Works very smoothly, and if the user connection is fast
enough,
> he
> doesnt even notice the window.
>
Also for reference, but I would recommend to everyone that they not rely
on Javascript and simply do all of this in the main window. With Pop-Up
Blockers and different browser versions, Javascript should be avoided if
possible unless you really know what your audience will be using (or
don't care).
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/