Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Page Printing Problem

Status
Not open for further replies.

Gordoweb33

Programmer
Nov 7, 2000
7
CA
Hi,
I've been working with PHP and MySQL under windows for about 2 weeks and a little bit. I've been cruising along without any great difficulty, however I have hit a problem that has now stumped me. What I am attempting to do when the problem occurs is to tabulate the results from a MySQL query that I perform on my databases. Well I can successfully query and tabulate the results without any difficulty. The problem arises when I try to print the ensuing report. I get that the data from the POST method has expired and to reload the page. Now this happens if I go to file->print under netscape or if I go to the print preview in the browser or even if I simply hit the print button.

I have no idea why this is happening because I have been able to output other information throughout the site and nothing is really different here. I am still using session tracking, I am consistent in the application of methods and in the querying of databases. Has anyone else run into this problem and if so how did you fix it?
Thanks for any help.
 
I realize this is an old post and perhaps you already found the answer, but if not, here's a shot in the dark.

I believe that on a print, the page is refreshed, piped directly to the printer. And if the browser only refreshes the content of the URI, it's not going to get anywhere.

So you can try to change the method of your form to GET... or, and this is the weird one, you can do something along these lines:

When the form is submitted through the POST method, have file1.php parse the data, get your SQL results and store them in a multidimensional array. Serialize the array, XOR encrypt it, whatever.. and when you return the page to the client, insert a meta-tag refresh that immediately sends them to file2.php?something=serializeddata ... Let file2.php ignore all the session crap and simply put together the HTML table from the array. See if this prints.

Like I said, complete shot in the dark.

brendanc@icehouse.net
 
Thanks very much for the help, it turns out that this problem is only occurring in Netscape at this point, it works great in IE, go figure. Would be nice if these two big boys could operate similarly, but that would make too much sense. I will try the switch to the Get method first and see if that helps.

Again thank you very much for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top