Reply to Re: Refresh problem and posts

Your name:

Reply:


Posted by www.douglassdavis.com on 09/18/05 21:46

John wrote:
> I have a problem with refresh.
>
> I have a contact form that sends an email when the submit button is
> pressed. I have a hidden variable and the code for emailing is only
> executed if the variable is set. The variable is cleared at the end of
> the code. All works as expected unless the REFRESH button is pressed
> by the user in which case the script is executed and the emails are
> sent once more. Debugging shows the test variable is set again even
> though it was unset before exiting on the previous run. How can this
> be?
>
> I know there are some things I could do like using database entries or
> cookies to hold the variable or even jump to another page which I do
> not want to do.
>
> There must be a simple explanation and hopefully solution to this.

the browser actually saves all of those POST variables... If the user
requests the page again, the way the browser displays the same page, is
to resend the same variables.

there are several solutions. one is this:

1. when form submitted via post, send the email, then
2. imediately redirect to the same page, maybe with a querystring
paramater of emailsent=1 and username=Joe Public.

When the page is displayed with the GET emailsent parameter set to 1,
then you can say "Thanks you Joe Public for sending the email." or
whatever.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация