|
Posted by Pedro Graca on 11/14/06 23:17
Shelly wrote:
> 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.
I see you got it! :)
And I like the different page technique better, too!
Anyway, if you want to trust your users ( *NEVER DO THAT* ), maybe this
little change would work:
<?php
session_start();
if (isset($_POST['theSubmitButton'])) {
if ($_SESSION[$_POST['tid']]['submitted']) {
// OOPS!
} else {
$_SESSION[$_POST['tid']]['submitted'] = true;
// rest of script;
}
}
// ...
echo '<input type="submit" name="theSubmitButton">';
$tid = md5(time());
$_SESSION[$tid]['submitted'] = false;
echo '<input type="hidden" name="tid" value="', %tid, '">';
// ...
?>
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
[Back to original message]
|