Reply to Re: unsetting

Your name:

Reply:


Posted by Jerry Stuckle on 11/14/06 03:14

Shelly wrote:
> I have the following for a test of the submit button being pressed:
>
> if (isset($_POST['theSubmitButton'])) {
>
> This works fine and I have been doing this for a long time. Here is the
> question:
>
> If I do a submit and have it come back to the same page, all is fine. If I
> now click the browser refresh button, I get another submittal. How do I
> "unset" the status so that it doesn't think I clicked the submit button when
> I click the refresh button?
>
> Shelly
>
>

You can't just unset a $_POST variable (well, you can, but it won't work
like you want). When your user hits reload on the browser, the browser
will resend the post, setting it again.

You can, for instance, have the submit button go to another page to
process the data, then redirect back to your original page with a
header() call.

You can also set a value in the $_SESSION to indicate the page was
submitted; you just need to ensure you have a way of unsetting it once
they leave that page.

There are other ways - but these are the two I use most often.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[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

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