Forum Moderators: coopster
Right now, when you filter by a tag, it goes to this URL:
http://example.com/b/?what=Youtube and it displays all posts with a YouTube tag.
If you filter by a multiword tag, it goes to something like this:
http://example.com/b/?what=Steve%20Jobs and tries to display all the tags with a Steve%20Jobs tag. None show up, because in the database they are tagged as Steve Jobs.
I came up with this code to try to replace the %20 with a space, but so far it hasn't worked:
if(!isset($_GET['what']))
{
$what = "unread";
} elseif(preg_match("/%[20]/", $what))
{
$what = preg_replace("/%[20]/"," ",$name2);
}
else
{
$what = $_GET['what'];
}
Does anybody see what I'm doing wrong, or have any other ideas about what do to about this? I think there might be a way to fix it using mod_rewrite, but I've never worked with that before so I'm not sure where to start.
I'm sure this is a pretty common problem, so hopefully you guys can help me. Thanks.
[edited by: coopster at 6:50 pm (utc) on May 9, 2008]
[edit reason] used example.com for domain [/edit]
Why not just use the PHP function to urldecode [php.net] it?
However how about urldecode [php.net]? As this should change your encoded space into the real thing to allow you to show the correct page from your database.
<edit>
Beaten to it ;)
[edited by: PHP_Chimp at 6:57 pm (utc) on May 9, 2008]
I tried changing the code to this, just to see if the problem was something else:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = "Steve Jobs";
}
Even that code doesn't load the tags for "Steve Jobs". I checked the database, and the tag appears in the database as "Steve Jobs" without the quotes.
Does anybody know at what point the space is being replaced, so that I can do something about it there?
Thanks.