Hello How can I show a HTML code in PHP? Such as: <? echo ' <form method="post" action=""><br/> <!-- Inputs Go Here --><br/> </form>'; ?> Without it actually creating the form, so on the page you would see the code: <form method="post" action=""> <!-- Inputs Go Here --> </form> Any help is appreciated. Edit, never mind, found out I had to use character entities.
Don't use PHP... <?php // Any code ?> <pre> <form method="post" action=""> <!-- Inputs Go Here --> </form> </pre> <?php // Any more code ?>
Better still, don't put HTML code in your PHP files. Use a template library such as smarty or phplib's instead.
Maybe I'm getting completely off base... <?php $str="<p>Some Example</p>"; echo htmlentities($str); ?> Code (markup):
Like this: <form method="post" action=""><br/><br /> <!-- Inputs Go Here --><br/><br /> </form>'
You can use ADV echo... <?php echo <<<html <form action="ccc.php" method='post> ... </form> html; ?> Code (markup):
<?php echo htmlentities(' <form method="post" action=""><br/> <!-- Inputs Go Here --><br/> </form>'); ?> PHP: EDIT: Oops, never realised you found out how to do it.