[英]textarea post value getting cut off by &= in url
I have a textarea that submits its value to a php page onkeypress. 我有一个textarea,它将其值提交给onkeypress的php页面。 the problem is, if you type a url like so into the textarea:
问题是,如果您在textarea中键入如下网址:
http://website.com/index.php?value=1&othervalue=2
the php page receiving the textarea data interprets &othervalue=2 to be the cutoff point for the text area as if othervalue=2 was another post variable it is supposed to receive. 接收textarea数据的php页面将&othervalue = 2解释为文本区域的临界点,就好像othervalue = 2是它应该接收的另一个发布变量一样。 If this doesn't make sense I will try to explain it differently.
如果这没有意义,我将尝试以不同的方式解释它。 Any ideas to get around this?????
有什么想法可以解决这个问题?????
I assume you're using ajax (since you're using onkeypress), make sure you always escape your data properly. 我假设您使用的是ajax(因为您使用的是onkeypress),请确保始终正确地转义数据。 See encodeURIComponent
参见encodeURIComponent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.