PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Most text I enter into the text area can be used by php in the target page without any problems. But if I type the characters % or £ in the text area I get following the error message in target.php:
Not Acceptable
An appropriate representation of the requested resource /empty.php could not be found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
...with % in the textarea the url reads target.php?newdata=%25 and with £ in the textarea the url reads target.php?newdata=%A3
I've looked at urlencode and htmlentities but how do I apply them to a text area before the form is submitted and the contents sent to the querystring?
dameunmate wrote:I've looked at urlencode and htmlentities but how do I apply them to a text area before the form is submitted and the contents sent to the querystring?
That'd be something that you'd do on the client-side (JavaScript, VBScript, etc.) or allow the server to handle. I'd try ~jraede's suggestion. It helps with some form difficulties in Apache.
Thanks for the tips! I have no idea about .htaccess so I'm going to read up on it now. If it helps here's a link to my phpinfo(): http://piano-tuning.co.uk/info.php - somebody else said I should look at Apache modules, I wonder what they are? It's so strange I've never had a problem with % or £ symbols in the querystring before...
yes I note that if I use POST I don't get the same error. Is there a reason for this? And is it possible to have a percentage % or pound £ symbol in the querystring in a php document when using GET?
dameunmate wrote:yes I note that if I use POST I don't get the same error. Is there a reason for this? And is it possible to have a percentage % or pound £ symbol in the querystring in a php document when using GET?
The input data is urlencoded when it's sent as a GET query (i.e. included in the URL). This does not happen when you use POST.
So when using GET, you have to urldecode the input before using it.
The superglobals $_GET and $_REQUEST are already decoded. Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results.