douluolan9101 2014-09-02 18:42
浏览 71
已采纳

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?

  • 写回答

1条回答 默认 最新

  • dqd54099 2014-09-02 21:53
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)