Page 1 of 1

Passing html from one page to another

Posted: Mon Dec 06, 2010 5:50 am
by klevis miho
How can I pass html from one page to another?

I know how to pass simple values:
<input type="hidden" value="test" />

But when passing html in the value, for example a table:
<input type="hidden" value="<table><tr><td>test</td></tr></table>" />

it prints the table.

Any idea?

Re: Passing html from one page to another

Posted: Mon Dec 06, 2010 6:30 am
by social_experiment
What if you equate the html code you want to sent to a variable and pass that along?

Re: Passing html from one page to another

Posted: Mon Dec 06, 2010 10:01 am
by AbraCadaver
klevis miho wrote:How can I pass html from one page to another?

I know how to pass simple values:
<input type="hidden" value="test" />

But when passing html in the value, for example a table:
<input type="hidden" value="<table><tr><td>test</td></tr></table>" />

it prints the table.

Any idea?
htmlentities(), then html_entity_decode() on the receiving page if you need to.

Re: Passing html from one page to another

Posted: Mon Dec 06, 2010 10:08 am
by klevis miho
Thank you, I've tried both of the functions.
But there was a problem when the html file contained double quotes.

I've came around this problem by replacing the double qoutes with a character like "#", then replaced them back to double quotes.

Re: Passing html from one page to another

Posted: Mon Dec 06, 2010 10:14 am
by AbraCadaver
I don't know what problem you had with double quotes, but did you look at the arguments for these functions?