0

So I have a php page called "view_employee.php" on that page, the user can press an "Edit Divisions" button and go to the "edit_employee_divisions.php" page. That page contains a form that submits to PHP_SELF so that the user can add, update, or remove divisions from the employee. Here's my issue:

Since the form on "edit_employee_divisions.php" POSTs to itself, (with proper PRG), if the user adds the employee to multiple divisions (user selects a divisions, hits Submit, the page PRGs to itself, user selects another division, hits Submit, page PRGS to itself, etc...) then when the user wants to hit the Back button to get back to the "edit_employee.php" page, he has to hit Back as many times as he has added/updated/removed divisions (so if he adds the employee to 3 divisions, he'll have to hit Back 3 times before he's back at "edit_employee.php"). Is there any way to prevent this from happening and have it go back to "edit_employee.php" after only 1 press of the Back button, no matter how many times he has submitted the form to itself on the "edit_employee_divisions.php" page?

Thanks!

D.R.
  • 1,199
  • 5
  • 19
  • 42
  • after every submit redirect to the starting point –  May 20 '13 at 04:22
  • 2
    Put a button like `back to edit employee page` and redirect to it after click – Amir May 20 '13 at 04:27
  • I don't want to always redirect them back to "edit_employee.php" after adding a division. I want them to be able to stay on the "edit_employee_divisions.php" page so they can keep adding/updating/removing. I have used your solution with other pages (Transitioning from view_employee.php to edit_employee.php for example, once they hit "Update" on edit_employee.php, it PRGs back to view_employee.php) I was hoping there was a different way to do it – D.R. May 20 '13 at 04:27
  • You have to put a back button explicitly to do this because browser captures all the histories and go back according to them. – Manish Jangir May 20 '13 at 04:34
  • 1
    http://www.sitepoint.com/javascript-history-pushstate/ may help you a lot – Manish Jangir May 20 '13 at 04:36
  • I love that HTML5 handles this finally! However, I know clients will be using it on IE versions as old as 7 possibly, so that won't work either (yet). I may just have to do a hardcoded "back" button on the page itself – D.R. May 20 '13 at 04:55

0 Answers0