Page 1 of 1

html encoding

Posted: Sat Feb 28, 2004 11:58 am
by cauri
new to php.
I have html code stored in a mysql database. When the query results come up, I would like the html to format naturally in the browser. How do I do this?

cauri

Posted: Sat Feb 28, 2004 12:29 pm
by Weirdan
Ehhh... just [php_man]echo[/php_man] it :D

Posted: Sat Feb 28, 2004 2:05 pm
by no_memories
For xhtml:

<?php echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

For other html types follow the same rules as above but without the xml. Simply make your doc type so that PhP can recognize and process it.

Don't forget to make your document end with a .php instead of say .html

Posted: Sat Feb 28, 2004 7:18 pm
by Weirdan
no_memories wrote: For other html types follow the same rules as above but without the xml. Simply make your doc type so that PhP can recognize and process it.
Doctype has nothing to do with PHP :o And even HTML has nothing to do with PHP ;) HTML is just a plain text from the PHP point of view.

Posted: Sat Feb 28, 2004 9:01 pm
by m3mn0n
Though in newbie logic echo()'ing or print()'ing HTML might seem that it wll display
<font color="red">Text</font>
instead of
Text (red text)
but it does not. It will be parsed by the browser as normal. :)