Jump to content
popwar

Converter campo de texto para html

Recommended Posts

popwar

Boas,

Tenho um campo de comentarios numa tabela em mysql, estou a tentar devolver o texto que tenho nesse campo para o php mas quero incluir links no texto.

Se passar a string normal, não me interpreta as tags de html, apenas me devolve o texto com as tags por extenso.

Alguém sabe como poderei dar volta a isto?

Share this post


Link to post
Share on other sites
mAiN_iNfEcTiOn

quando fizeres o echo, experimenta fazer:

echo html_entity_decode($string);

Share this post


Link to post
Share on other sites
popwar

Pois, era o que inicialmente tinha, mas não estava a passar correctamente as tags..

Resolvi o problema com a função nl2br:

echo nl2br($string);

Obrigado pela ajuda de qualquer das formas  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.