I have the following answer:
<<?php echo $valor->usu_id; ?>>
However, it is interpreted by the browser as TAG and not as a return. How do I return it without being tagged? In this example, I would return% with%
I have the following answer:
<<?php echo $valor->usu_id; ?>>
However, it is interpreted by the browser as TAG and not as a return. How do I return it without being tagged? In this example, I would return% with%
Use HTML entities, like this:
<<?php echo $valor->usu_id; ?>>
An example in pure HTML:
Vira tag: <br>
<foobar>
<hr>
É "visivel": <br>
<foobar>
List of HTML entities in the w3.org site: link
If the content comes from a variable in PHP (or bank) you can use htmlspecialchars
like this:
<?php $foobar = '<foobar>'; ?>
<?php echo htmlspecialchars($foobar); ?>
Note:
The difference of
htmlspecialchars
andhtmlentities
is thathtmlspecialchars
only encodes characters that have some meaning for HTML, whereashtmlentities
encodes everything that has the equivalent in "HTML entities" / em>
Note that the <xmp>
tag may also have the same effect, however it is deprecated (though it still works):
<xmp><foobar></xmp>