Hi,
I have been trying to come up with an idea to reduce double submissions
where a user clicks refresh and, for example, another row is INSERT
into a table.
Originally, I would have a form page. When a user submits the form (ie.
index.php), I would script it so that when the form action would be the
same page but it would use the address 'index.php?action=add'. This is
bad (mmm-kay) as when the user refreshes the page it would add another
row into the database table.
The solution (thanks to a reply on this newsgroup) is to have a
different page to carry out the form processing and depending on the
result either redirect them to a successful or unsuccessful page (or
the same page but different outcomes as a result of scripting).
Anyway, my idea is very similar to the above where a user will fill in
the form. They will then be submitted to a page called action.php. This
action page will deal with all scripting associated with this news
admin system I am planning, including add/edit/delete pages. They will
be dealt with by passing the rellevant instruction with the GET
parameters (ie. action.php?action=delete). Should an error be found
then it will be highlighted in the action page and a link back to the
form page will be provided with the values entered passed back using
POST variables. In the event of a successful entry, the user will be
redirected back to the form parent page (view article (parent) -> edit
article (child)) with passed GET info (ie. view.php?action=add) where
as it knows what action was carried out it can assume that it was
successful and the 'You have successfully added a news article' message
would be displayed.
Im pretty confident that this system would be a big improvement but
would be greatful if anyone who does this in a similar way would give
comment. Cheers
Burnsy