View Full Version : passing parameters from one page to another

12-11-2010, 06:43 PM
I have written some code that retrieves data from a MySQL database using PHP. The code cycles through the table building up a string of values (12 in total) from each record read that satisfies certain criteria. The string of values from each record is separated from those from the next record by an ampersand. The code then opens a new page passing the string to another page. The code is.....


The new page then displays the resultant calendar (for year quoted) highlighting dates based on the value of $build.

Typically, for two records that satisfy the criteria, $build looks like this...


This works fine in all browsers IE6, Firefox 2.0, Firefox 3.0, Chrome, Avant.

However, I received a report to say that it does not work with IE8.

On testing I have found that using IE8 I can successfully pass the parameters if there is only a few of them (for example 20) but when I pass a large number (say 1000) then IE8 reports that it is unable to open the page. I have no problems with other browsers.

Can anyone please help me to understand why this is happening. Does IE8 have a limit on the number of parameters that can be passed from one page to another?

12-11-2010, 07:11 PM
The total length of values passed via a URL may be limited and whether or not it will work with very long strings is hit or miss. Sounds like you are hitting one of the miss cases.

GET submissions are the most restricted. The maximum length of a get
varies from server to server, browser to browser, OS to OS. You can
pretty much count on at least 256 characters, but over that you will begin
to run into problems with some browsers and servers. GET was never
intended for large amounts of data but rather for information to be
appended to the URL so that a bookmark and later return is possible (there
are other uses as well, such as session tracking without depending on cookies
for instance).

POST submissions have no limits as defined by the RFCs. However, it is
not uncommon for scripts to set some arbitrary upper limit to prevent a
user from uploading data (say a file for instance) so large that it
impairs either the script's operation or the operation of the limit. The
real limiting factors in a POST outside of an arbitrary limit set by a
script programmer are in terms of bandwidth, time (to upload), and memory
and disk space on the client and server ends of the exchange.

12-12-2010, 01:56 AM
Why not pass it with a hidden form input and use $_POST?

12-12-2010, 10:37 AM
Thanks for your replies. The page loaded is written in Javascript (because it is fairly intricate code and I'm not even sure that it could be written in PHP). So, yes, I could have a hidden Form on the PHP page and then "pick it up" in the loaded Javascript page. I've done this in a few pages on the web site but not sure that I have done it from PHP to Javascript. I will look at this approach.

12-12-2010, 09:51 PM
I couldn't solve it with $_POST as the new page is written in Javascript. The page (actually frame) written in PHP code is closed and opens a new (Javascript coded) frame. If I knew how to load values into another frame using PHP then I could find a solution but I suspect that this is not possible. I have solved it using a mixture of passing parameters and cookies. Not elegant but it works.