Solved

Going back to previous web page generated with a MySQL query fails in IE8

Posted on 2010-09-16
7
448 Views
Last Modified: 2012-06-27
I have three web pages we will call page1.php, page2.php and page3.php. Page1.php has a search box and allows the user to search a MySQL database which returns results in an automatically generated table displayed on page2.php. Page2.php has code to split results into pages of 25 result per page, and code to display both "next" & "prev" links, as well as hyperlinked pagenumbers. Someone can select a link on page2.php which goes to page3.php to play the requested video file. Page3.php has an embedded player and chooses to play a file based on information passed through the URL (http://www.website.com/page3.php?video=videoname).

The problem here is when a user selects the back button, or the javascript "return to previous" link on page3.php it goes back to "Webpage has expired" in IE8. The same pages seem to work in Firefox and in Safari on the iPhone, however it is critical it work in IE8.

I am at a loss.
0
Comment
Question by:AMPLECOMPUTERS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:trippy1976
ID: 33695619
Check this out:
http://support.microsoft.com/kb/183763

In the mean time, an idea is to open the links to videos in new pages using _blank as your target for now.
0
 
LVL 4

Expert Comment

by:trippy1976
ID: 33695650
You could try tucking this in the top of the results page too to see what happens:


<meta http-equiv="Pragma" content="no-cache">
0
 

Author Comment

by:AMPLECOMPUTERS
ID: 33695750
I checked your link and it is for IE4 and states that the latest version of IE fixes the problem (evidently not), it also refers specifically to ASP which I am not using, but interesting information anyway. One other fix they mention is to go into internet options and adjust a setting, I can have every potential visitor do that so that option will not work for me even if it fixes the problem on my machine.

I tried your second idea with the meta tag, did not work.

I may try opening them in a new page if no one else has any ideas, I just really hate to do that.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 4

Accepted Solution

by:
trippy1976 earned 500 total points
ID: 33703568
is this a secure page (https?)

Here is an article about this focused on PHP

I don't believe the issue is specific to IE8.  Your IE8 settings are probably "just right" for it to happen, but I suspect it could happen to anyone else with those exact settings on any other browser.  It appears to be due to caching.  Have you tried it using IE8 from a few other computers?

Here is the link:

http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings
0
 

Author Comment

by:AMPLECOMPUTERS
ID: 33709932
trippy,

No, this is not a secure page. I read the article you linked to and first off, I am not using sessions. Secondly, I believe the second solution is correct in that I am indeed using the $_POST command to get information for the page. The problem seems to be that the post data is lost in IE8, but not in FF.

The solution in the link you provided seems a little weird, I really don't understand why an "elegant" solution requires a third page, and what the third page really is.

Following my earlier discussion.... page1.php would contain the form, then I would pass the form off to page1a.php which would then process the form and display the data? Then what do I do with page2.php?

I could use a different method of sending the information to page2 from page1 which currently uses the POST command. The problem with that is I use a FORM to get search keywords which are then POSTed to page2 and processed from there. I am not sure how I can tell the form to pass a variable without using the POST command. Here is the current form:
[code]
   Search the short description field:<br />
   <form action="search2.php" method="post">
       Enter words to search for (leave blank to display all records):<br />
      <input type="text" name="keywords" size="20" maxlength="40" value="" />
      <input type="hidden" name="sqltype" size="1" maxlength="1" value="1" /><br />
      <input type="submit" value="Search!" />
   </form>
[/code]

Unless of course I used page1a to translate the POST data into GET data in the URL and could append that data to the location header? Something like this:

page1 - > keep existing form data except under action change page2.php to page1a.php
page1a - > use header('Location: http://www.website.com/\'.$ConvertedFormData.'\''); along with code to read the POST data and convert it to GET data in the URL
page2 -> convert to use GET data instead of POST data

Sound good? Can the header be below the processing code?
0
 

Author Closing Comment

by:AMPLECOMPUTERS
ID: 33711254
I went ahead and tried it this morning and so far that seems to work fine. Here is what I did:

page1 - > keep existing form data except under action change page2.php to page1a.php
page1a - > use header('Location: http://www.website.com/\'.$ConvertedFormData.'\''); along with code to read the POST data and convert it to GET data in the URL
page2 -> convert to use GET data instead of POST data

using this code in page1a.php:
[code]
<?php
      $keywords = $_POST['keywords'];
      $sqltype = $_POST['sqltype'];
      $varpass = "?sqltype=".$sqltype."&keywords=".$keywords;
      header('Location: http://www.website.com/videos/search2.php'.$varpass);
?>
[/code]

I no longer the page is expired message in IE, it still seems to work in FF, and of course it never displays anything from page1a.php. Thanks!
0
 
LVL 4

Expert Comment

by:trippy1976
ID: 33717228
Another possible option, if you choose to use sessions, is to have page1 submit to page2, which is not a "page" but a script.  Have it take the $_POST information and tuck it into a session variable and forward to page3, which is the results page.  Page 3 can then use the variable in session and not the post information to generate the results.

The thing with $_GET[] is that it has limits and exposes data you may not want exposed.  Also, if you're going to use GET, you could just change the method on your form I think.

Anyway, hopefully you are making progress, thank you for the points.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question