Answer the question
In order to leave comments, you need to log in
script tag inside block?
Hello everyone, I have a question.
I have a string in a div tag and it contains a script tag (as plain text). But the browser recognizes it as a tag and puts everything after it inside the tag. Tell me how to fix this)
You can use php and js, but I would like to find a solution without them)
Answer the question
In order to leave comments, you need to log in
Escape HTML special characters:
php.net/manual/ru/function.htmlspecialchars.php
echo htmlspecialchars('<script>...</script>', ENT_QUOTES);
// <script>...</script>
$text = $_POST["comment"];
echo htmlspecialchars($text);//can also return htmlspecialchars($text);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question