Jump to content

Back button doesn't appear to be working correctly.


KS3MAW

Recommended Posts

Hello,

Thanks for your help in advance.
When some users use the Back button coded below the previous screen doesn't present the data it had when they went to it.
Typically it's a list of classes assigned to that instructor.
For this specific user it happens every time.
But many if not most it functions correctly.
Does anyone see anything wrong with the code?  Or is there anything I can add to ensure it goes back correctly.

Please forgive, I am new to PHP and this is inherited code from a much more experienced coder.

 

<input type='button' value='&nbsp;&nbsp;Back&nbsp;&nbsp;' onclick='document.location.href="index.php?<?=($session["admin"]?($_REQUEST["my_courses"]?"my_courses=1":"admin_view=1&term=".$term):"")?>"' />

Link to comment
Share on other sites

That's because your "back" button is not a back button. It's a link that takes the user to the URL of the previous page. Which, in all possibility, is not going to present them with the same information as it had when they left it.

Question #1: Why do you have a back button at all?
Question #2: Why aren't people using their own browser's back button?

Link to comment
Share on other sites

Well, it seems to work.

They get an error message to retry and resend.

But that is much better than forcing them to log out and then back in.

We are getting rid of this app in a few months.

SO as far as I and my boss are concerned, we're all good!

THANK you so much!!

Link to comment
Share on other sites

It may be possible to eliminate the resubmit warning too: by redirecting after a form submission to a reasonable page. That could be the same URL or a different one, point is that the page the user sees is from a normal GET request instead of displayed during their original POST request.

It's called POST/Redirect/GET.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.