Well, you have three solutions. One, you finish it the way you started, in which case you'll need to use htmlspecialchars() on $out in the form (otherwise you'll almost certainly escape from the form tag sooner or later). Two, you store the data temporarily in a database or something (faster for the user, they don't get to download the data twice). Three, you re-generate this page on request. This is what I would do, personally: I would link to the same page, only sending some parameter (e.g. "&xls_output=true"). Then, at the beginning of the page you can test for $xls_output and simply dump them headers in front of the whole shebang if needed.

HTH

Bogdan

Joffrey Leevy wrote:
Most humble apologies.  Trying to create an excel file
of the current php page which can be downloaded.  What
I've been doing is creating an output buffer and then
using ob_get_clean to retrieve the page contents.

for example, $out=ob_get_clean();

Now everything works up to there, but when I try to
post $out in a hidden form to another page it doesn't
work.


echo "<formaction='nextpage.php' method='post'> <input type='hidden' name='out' value='$out'> <input type='submit' value = 'save as xls file'> </form>\n";

And on nextpage.php I have

<?php
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment;
filename=\"test.xls\"");
echo $out;
?>

To make a long story short, this does not work. Grateful for any help.



--- Bogdan Stancescu <[EMAIL PROTECTED]> wrote:

You didn't provide much help by not answering the
very question in the title. _HOW_ would you want to send it? Via a POST
variable? Internally, via a plain text file? Internally, via memory
sharing? Via e-mail? Also, it would be interesting to know what exactly you're
after, that could help people maybe suggest some alternate methods to
what you're currently trying. Are you trying to back up data?
Replicate? Synchronize?


Bogdan

Joffrey Leevy wrote:


Hi:

Does anyone have info on sending the contents of

an


entire php webpage to another php page on the same
server?  A little code would be helpful.

Thanks

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php




__________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to