I am developing a script that retrieves HTML tags from a form, and then store it in the database. However I would like to store the code in the base as it was entered in the form, with the tags, style, classes, etc ...
OBJECTIVE :
-
For example, if I store the code
<div style='color:red;'>Meu texto</div>
When reading this information (with PHP for example: echo $informacoes_da_base
) I would like to get "My text" in red.
PROBLEM :
-
Tags are being interpreted as soon as they arrive at the base. Ex:
&lqt;code &lql;
-
When reading the information in the database eg
echo $informacoes_da_base
I get unwanted characters on the screen.
I did some research on mysql_escape_string
and html_entity_decode
but I can not get the results you want.
echo html_entity_decode($infos_da_base);
echo mysql_escape_string($infos_da_base);
CODE :
if(isset($_POST['enregistrer'])){
Configuration::updateValue('DESCRIPTION_TIME_DELIVERY', $_POST['description']);
}
<form>
<textarea style="width: 200px;">
<code style='color: red;'>codigo html aqui</code>
</textarea>
</form>