0

I use codeignitier and I would like to save some html code (templates) into the DB.

the problem is that I got every time the entities saved into the DB. I've this &lt ; instead of <

In my lib I put

$this->ci->form_validation->set_rules('html_text', 'HTML text', 'htmlspecialchars');           

and

$html_text   = $this->ci->input->post('html_text',true);                

in my view I use a textarea and CKeditor

thanks for the help

1 Answer 1

0

When you post the text field the contents are ASCII encoded for transit. Which is what you are seeing in the data. De-encode on the server before storing to data, or else dencode on the client side after retrieving. I would recommend doing these things on the server as you need to prevent XSS and SQL injection (because what you are doing can be very dangerous). Use a validation library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.