views:

29

answers:

3

How do i repost post data, so that i can generate a print preview of a page, by applying a different style sheet. GET is not an option as the data can exceed url length limit.

Here is the premise, FORMPAGE posts data to RESULTSPAGE, RESULTSPAGE has a print preview button which reloads the RESULTSPAGE page and applies the print style sheet, so that the user can see the preview in the browser before printing. Currently I was Passing the form data via GET *(resultspage.php?value=print&data=data)*, however this won't do for larger amounts of data.

The manual option is to collect all the post data and pass the data through hidden form fields or perhaps use CURL, although I cant seem to visualize how that will work.

JSP has a Request Dispatcher, i guess

+1  A: 

I think this article might help you switch the stylesheets : http://www.alistapart.com/articles/alternate/ See the setActiveStyleSheet() function

greg0ire
my idea too, but you beat me to it :)
Christian Smorra
@Christian Smorra : This is good, abel will have the choice between jq/non-jq solutions :)
greg0ire
ow my bad. why didnt i think of that! thx
abel
A: 

rather than reposting data you could just switch the stylesheet on-the-fly with javascript http://www.kelvinluck.com/2006/05/switch-stylesheets-with-jquery/

Christian Smorra
A: 

I think that the previous two answers are both solid ideas if all you are doing is really just switching stylesheets. PHP cannot interact with this data one it has sent it back to the server without storing it in some way. So you can have it all come back via hidden input fields as you described, store the value in the session waiting for the response to return, but these are all pretty odd solutions.

If all you are doing is switching out the stylesheet then you should try what the previous answers suggest, if you need to change other pieces then I think the best way to go would be to put the data inside of hidden fields.

PS CURL won't really help you out in this situation, nor will JSP, the interaction you're looking for is happening client side, not server side.

Boushley