Reply to Re: unsetting

Your name:

Reply:


Posted by Shelly on 11/14/06 20:55

"Pedro Graca" <hexkid@dodgeit.com> wrote in message
news:slrneljssk.38r.hexkid@ID-203069.user.individual.net...
> ["Followup-To:" header set to comp.lang.php.]
> Shelly wrote:
>> If I 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?
>
> You don't.
>
> What you can do is keep a variable for that specific form.
> When you receive the submission, verify the variable to check whether
> it's the first post.
>
> <?php
> session_start();
> if (isset($_POST['theSubmitButton'])) {
> if ($_SESSION['submitted']) {
>
> // OOPS!
>
> } else {
>
> $_SESSION['submitted'] = true;
> // rest of script;
>
> }
> }
> // ...
>
> echo '<input type="submit" name="theSubmitButton">';
> $_SESSION['submitted'] = false;
>
> // ...
> ?>


This would work in most cases, but not in my situation. You see, my case is
that I display a list of entries (notes) from the database in reverse
chronological order of entry. At the top of the form I have a set of fields
to add a new entry. After the entry is added (via the update) it displays
the the new list with the new entry at the top. The user must be able to
add yet another entry if he puts one in and clicks the submit. What I want
to avoid is having an entry there because of the refresh button.

[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

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