Echo不会将txt文件中的复制粘贴文本显示为PHP文本区域

问题描述:

This is maybe a stupid problem to solve but i've looked around and i can't manage to find a viable solution.

I'm making a simple form where:

  1. the user write some text into text-areas
  2. the php must echo back those data into a simple html code to copy it somewhere else

something like this: http://www.w3schools.com/php/showphp.asp?filename=demo_form_validation_complete

but there is a problem even in the demo from w3schools: when i have some text into a *.txt file or another web page/local document and i copy(or cut) and paste it into the form and send to receive the echo it sends back a "null" value from the variable, while it doesn't happen when i type into it.

How can i solve this? Is there a way to send to the variable a copy-pasted text instead of a "null" value?

这可能是一个愚蠢的问题要解决,但我环顾四周,我无法找到一个可行的 解决方案。 p>

我正在制作一个简单的表格: p>

  1. 用户将一些文字写入文字区域 li >
  2. php必须将这些数据回显成一个简单的html代码,然后将其复制到其他地方 li> ol>

    这样的内容: http://www.w3schools.com/php/showphp.asp?filename=demo_form_validation_complete p>

    但是即使在w3schools的演示中也存在问题:当我在* .txt文件或其他网页/本地文档中有一些文本并且我复制(或剪切)并将其粘贴到 表单和send接收echo它从变量发回一个“null”值,而当我输入它时它不会发生。 p>

    我该如何解决这个问题? 有没有办法向变量发送复制粘贴文本而不是“空”值? p> div>

You may have an apostrophe in the copied text and it's being converted into a curled apostrophe (see: http://www.dwheeler.com/essays/quotes-in-html.html). If you're just echoing it back out to the screen, you could wrap the $_POST['content'] in a htmlentities().