This is my code:
<?php
$baseurl = '<base_url>';
?>
<font class="font_style"><?php echo $baseurl;?></font>
When iam trying to display the variable $baseurl it takes as as a html tags and nothing will bedisplayed
But i want to display as:
<font class="font_style"><base_url></font>
How can i do this?
<?php echo htmlspecialchars ($baseurl);?>
Check htmlspecialcharsdoc and htmlentitiesdoc.
Use the html entities <
and >
instead of the special characters <
and >
.
Same goes for some other characters, most prominently &
instead ot &
. Here's a reference for you:
http://www.w3schools.com/html/html_entities.asp
http://www.w3schools.com/tags/ref_entities.asp
<font class="font_style"><?php echo htmlentities($baseurl);?></font>