Save data in database with HTML tag in Joomla

As there are lots of editors are available to post content on web site, it also increase the chance of bad html to be inserted with data. Which may weird the look when loading on site. So to avoid this thing, Joomla by default filter all the HTML tag inserted from front end editors. But sometime we must need html tag coming from editor then we can use below code to give instruction to Joomla that don’t filter html tag for this particular variable only.

$post['description'] = JRequest::getVar('description', '', 'POST', 'string', JREQUEST_ALLOWHTML);

Here ‘description’ is field name comes from submitted form and which containing string with html tag. So here JREQUEST_ALLOWHTML will all html tags to be save in database.

Hope it helps…

Keep it up…
Coreway Solution 🙂