Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Filter String - request post

Hi guys,

I have the following string: "<p> Test Test </p>", when I recover in $this-> request-> get ('field', 'string'); I lose the html tags, would like to keep, I was looking for filter.zep, it seems to have implemented this filter.

thank you!

echo htmlentities($this->request->get('field', 'string'));
// Test Test

echo htmlentities($this->request->get('field'));
// <p> Test Test </p>

Have tou tried removing the "string" filter? Also you could get confused when printing html in the browser because it gets rendered?

then receives data from a js editor (editor-alloy), and need to save the tags in the database, but my other concern is the XSS. I do not know if the htmlentities solve.

Vanilla PHP still works, so you could possibly use $_POST or $_GET



46.5k
Accepted
answer

If you really need to pass HTML formatted strings via HTTP GET, you can base64 encode them before sending (in your AJAX/JS). Then just base64 decode it on PHP/Phalcon.