I use my own AJAX code to send data, it worked, AJAX sent & PHP code gets a variable, but:
When I try send a link ( ex: http://abc.com/abc+/ ) or var like folder name has +
it return string without +
.
AJAX sends data as &data='+encodeURIComponent(data)+'
and PHP gets urldecode($data);
My problem is how to get PHP get variable from POST data without removing the +
char from my string.
Use rawurldecode()
in PHP. rawurldecode()
does not decode plus symbols (+) into spaces while urldecode()
does.
This way, whether your JavaScript sends the plus character as the literal string +
or as the encoded string %2B
, PHP will decode it as a plus character.