Another question about back button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Another question about back button

Post by Bill H »

I did a search and all the topics had to do with login/logout, password protection and multiple submission of forms.
My problem is much lower level than that.

I have a series of forms created by php: selection of an item in one page creates a page for selection of subitems of the selected item, etc.
(All coming from a MySQL database.)
Each form contains a "Return" button that moves the user up one level in the chain by means of <form action=blahblah.php>.

Problem arises when user clicks the back button and gets a "This page cannot be viewed without refresh" error. Any simple way to

A) allow user to use the back button without getting that error (obviously my first choice), or
B) prevent user from using the back button (gasp!)
ozmodiar
Forum Commoner
Posts: 35
Joined: Sat Jun 01, 2002 6:29 am
Location: Dublin, Ireland

Post by ozmodiar »

you could use a javascript window.open() function to open a new window for the first form. This allows you to select which window elements to show e.g. toolbar, addressbar, etc.

If you are not familiar with this function, try this link. It will tell you all you need to know.

http://msdn.microsoft.com/library/defau ... open_0.asp
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

you may also create a button that is a link you created in your script with $_SERVER['HTTP_REFERER'] (only one 'back'-step of course :( )

or redirect to the same page without any post-data with header('Location:..... or meta-equiv
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post by gotDNS »

You could set a session variable on each page for the last page they weer at, and then make a link out of it.
Post Reply