therefore, I have a field in which you can enter. After entering, click “OK”, and it will send an ajax call to save.php and insert it into the database (with php), and then output what you have. And then the ajax call for succes captures the output and warns it ( success: function(msg){ alert(msg) } ). the answer is in html.
Works well until I use ' or " in the field. Example, if I write: 'asdadsasd" turns out: \'asdadsasd\" How can i fix this?
I don't know if that matters, but in the save.php file I have:
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past header('Content-type: text/html; charset=utf-8');
And displays the message as follows:
echo htmlspecialchars(strip_tags($message), ENT_QUOTES, 'utf-8');
source share