开发者

variable in textarea template code closing textarea tag

I have in my control panel ( HTML template editor )

<?
$textarea = '<textarea>';
$textarea .= $template_code;
$textarea .= '</textarea>';
echo $textarea;
?>

The variable $template_code contains html, including </textarea>

开发者_如何学JAVA
for example -> $template_code = '</textarea> ......';

This means the variable will close my textarea and other code will be outside my real textarea!!

How i can avoid this?


use htmlentities to escape the special characters.

echo '<textarea>'.htmlentities($template_code).'</textarea>';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜