问题
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:
- the user write some text into text-areas
- 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