When I have URL like this
site.com/index.php?name=JON%20%20%20%20%20%20%20SMIT
and I print $_GET['name'] variable in index.php file, result is Jon Smit.
That is, queue spaces between JON and SMIT, are replaced on one space. why this happened?
This should preserve the spaces:
print rawurldecode($_GET['name']);
This will print the extra spaces, however your browser may ignore the extra spaces. Documentation
How the special chars (like the space) is encodet in the URL is defined, look also Wiki. You can URL encode via urlencode and the inverse of that is urldecode
About the ONE Space only: Look into the source of the Page (i.e. the HTML-Code), in Firefox e.g. via Ctrl+U, there will be many more spaces. BUT: The browser only displays one of them. If you want to preserve them in the output, you could use something like
echo '<pre>' . $_GET['name'] . '</pre>';
OR
echo str_replace(' ', ' ', $_GET['name']);