English 中文(简体)
用户提交的文本区域中的密码
原标题:strip HTML from a textarea submitted by user
  • 时间:2012-04-20 04:06:02
  •  标签:
  • html

I am using a plugin called "user submitted posts" - there is a text area which allows user to input the content here is the code :

<li class="usp_content">
            <label for="user-submitted-content" class="usp_label">Your Content</label>
            <div>
                <textarea class="usp_textarea" name="user-submitted-content" id="user-submitted-content" rows="5"></textarea>
            </div>
        </li>

问题在于,该守则允许用户输入超文本编码等。 我试图将其从超文本中删除,但我只想指出,有多少法典没有奏效、搜查和审判。

我确实赞赏有人告诉我,如何从上述法典中抹掉html,以便此人能够放行html。

问题回答

你们必须写这样的东西。

<?php
    $yourTextareaContent = $_POST[ user-submitted-content ]; // if form METHOD="POST"
    //$yourTextareaContent = $_GET[ user-submitted-content ]; // if form METHOD="GET"
    echo strip_tags($yourTextareaContent);
?>

您还必须在服务器方面(从您的表格中接收内容的网址文字)。

如果使用PHP,你可以使用:


echo strip_tags($yourTextareaContent);

strip_tags





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签