%20 Percent Sign / Space Causing Problems with PHP
Posted: Sat May 10, 2008 5:04 pm
I use a feed reader called Feed on Feeds that uses PHP/MySQL. It has a feature that lets you define some words to automatically tag, and if a new post comes in with those words in it, they get tagged.
I have several words set up, including some that are multiple words (e.g. Steve Jobs). They get tagged fine. When I check in the database, the articles include those tags.
When you sort by tag in the reader, it goes to a URL like this: http://www.domain.com/?what=Apple and then a GET function takes the Apple and displays all articles with that tag. When you sort by a tag that is multiple words, you get something like http://www.domain.com/?what=Steve%20Jobs.
That doesn't load any of the tags, possibly because of the %20 conversion.
I've tried going into the function where this appears:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = $_GET['what'];
}
and replacing it with:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = urldecode($_GET['what']);
}
but unfortunately that didn't solve the problem.
I also tried changing it to this, just to get a better idea of what was causing the problem:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = "Steve Jobs";
}
When it was changed to that, clicking on any tag, even a one-word tag, should bring up all of the articles that are tagged "Steve Jobs".
Anybody know what is going wrong, or if I am making a stupid mistake or something?
Thanks!
I have several words set up, including some that are multiple words (e.g. Steve Jobs). They get tagged fine. When I check in the database, the articles include those tags.
When you sort by tag in the reader, it goes to a URL like this: http://www.domain.com/?what=Apple and then a GET function takes the Apple and displays all articles with that tag. When you sort by a tag that is multiple words, you get something like http://www.domain.com/?what=Steve%20Jobs.
That doesn't load any of the tags, possibly because of the %20 conversion.
I've tried going into the function where this appears:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = $_GET['what'];
}
and replacing it with:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = urldecode($_GET['what']);
}
but unfortunately that didn't solve the problem.
I also tried changing it to this, just to get a better idea of what was causing the problem:
if(!isset($_GET['what']))
{
$what = "unread";
}
else
{
$what = "Steve Jobs";
}
When it was changed to that, clicking on any tag, even a one-word tag, should bring up all of the articles that are tagged "Steve Jobs".
Anybody know what is going wrong, or if I am making a stupid mistake or something?
Thanks!