Passing html from one page to another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Passing html from one page to another

Post 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?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Passing html from one page to another

Post by social_experiment »

What if you equate the html code you want to sent to a variable and pass that along?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Passing html from one page to another

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Passing html from one page to another

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Passing html from one page to another

Post by AbraCadaver »

I don't know what problem you had with double quotes, but did you look at the arguments for these functions?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply