I have a URL that contains a department name that will pull records from the database.
The URL looks like this: submissions.php?department=Settings,%20Security%20&%20Payments
which is the equivalent of Settings, Security & Payments
My query needs to pull records from the table where the department is equal to Settings, Security & Payments
.
How can convert that GET variable back to what I would expect it to be?
I tried html_entity_decode
but it ignores the &
and only gave me everything prior to that.
Whats the best way to do that?
Side note, if it was my data I would make it simple and pull it by ID but we dont have a table that has ID's for the departments.
<?php
$string = "submissions.php?department=Settings,%20Security%20&%20Payments";
$decoded = urldecode($string);
echo "Original string: $string
";
echo "Decoded string: $decoded
";
?>
Try urldecode()
You can see the manual here. http://uk3.php.net/urldecode
Use urldecode($your_URLstring)