I have a URL string similar to https://example.com/path/?welcome_screen=1&email_address=something else@example.com
In PHP, I call <?php echo $_GET['email_address']; ?>
This will produce something else@example.com
Specifically, the in the email address are replaced with spaces.
echo
code above?
Yes,
is a way of representing spaces in a URL. PHP automatically URL-decodes the value and converts it to spaces when creating the
$_GET
data because it assumes that's what the value in the original URL should represent.No, it was too late by then.
Yes, you should URL encode before including the value in the URL so that
is not treated as a special character. If PHP generates the URL, you can use the
urlencode()
function. Most other programming languages have equivalent built-in functions.