I have been experiencing problems with pages that use header().
I have a PHP page that does some processing of data (i.e. database INSERTs and UPDATEs) submitted by a form on the previous page using a POST. Please refer to this pseudocode:
- Form page
- User hits submit
- Data is processed on PHP page
- User is redirect to original form page with confirmation message.
After all of the processing is complete (at stage 2), I employ a header statement at the end of the page as follows:
// begin PHP code
$redirect_page = '/shipping/view_detail.php?id=' . $new_id;
header("Location: $redirect_page");
exit;
// end PHP code
It appears that for some users, the form data ends up being submitted more than once, sometimes twice, sometimes five times.
Is there a way to prevent this from happening? Any advice as to how to track this down and stop it would be great.
Thank you,
Mateo Nares