0
I’m developing a script retrieving codes HTML from a form, and then store in the database. However I would like to store the code in the base as it was inserted into 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
) would like to get as a result "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 base ex.:
echo $informacoes_da_base
I get on the screen unwanted characters.
I did some research on mysql_escape_string
and html_entity_decode
but I cannot achieve the desired results.
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>
How are you doing? Put the code.
– Marcelo de Andrade
Are you running the data through a function before entering it into the database? What is it? Can you tell?
– Miguel
This must not be true: "The tags are being interpreted as soon as they arrive at the base. E.g. &lqt;code &lql;" - if it is being converted, it is before the base.
– Bacco
Put the code snippet that captures the form, and saves it in DB, that the community will probably find the problem there. Only with the code you posted, the problem cannot be reproduced.
– Bacco