|
Posted by d on 09/28/46 11:42
<rcross@gmail.com> wrote in message
news:1142451440.774042.20390@i40g2000cwc.googlegroups.com...
> Any thoughts on this?
>
> Here's my situation. I've created a small, very light weight
> call-tracking system for my company. I've been as good as I could be
> regarding "good programming practices" (seperating content from
> logic/structure). My index.php file contains a logic structure and
> includes which lead to simple layouts which are controlled by a single
> css file. The structure is as follows:
>
> Does a valid session exist?
> No: Has a login form been submitted?
> No: Display login form
> Yes: Process login form and if valid, associate the user_id to the
> session_id
> Yes: Has the submission form been submitted?
> Yes: Submit data to database and display the form along with a
> "submitted" message
> No: Display the form
>
> If anyone refreshes the page AFTER data has been submitted, a duplicate
> entry is created in the database. I believe that the problem is in the
> $_POST['submit'] object itself. I know I'm not doing anything
> incorrect regarding normal field submission, so maybe it's just in the
> way I'm asking PHP handle the POST data? Is there a trick to have the
> script not re-submit the data if the data was already submitted once?
Process the $_POST data, then call:
header("Location: http://server/script");
exit();
(replacing server/script with your server/script) will bounce the user back
to the page. If they press F5 or try to reload, they'll just GET the page
again.
that seems to be the standard way of dealing with the multi-post issues.
> I have no idea how to get around this... I'd apprecaite any thoughts,
> even thoughts regarding my current logic structure! I'm curious to see
> if that is a normal logic structure to use for logging in.
>
> Thanks!!
dave
[Back to original message]
|