Echo doesn't show copy-pasted text from txt file to form text area PHP

╄→гoц情女王★ 提交于 2020-01-15 12:05:53

问题


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?


回答1:


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().



来源:https://stackoverflow.com/questions/25630161/echo-doesnt-show-copy-pasted-text-from-txt-file-to-form-text-area-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!