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!
%20 Percent Sign / Space Causing Problems with PHP
Moderator: General Moderators
Re: %20 Percent Sign / Space Causing Problems with PHP
Update: I'll give $5 through PayPal to whoever helps me get to the bottom of this.
Re: %20 Percent Sign / Space Causing Problems with PHP
There has to be something wrong somewhere else in your code. Did you try adding simple echo commands to those if statements because I see nothing wrong with them. Also, from my experience %20 causes no issues with $_GET
Re: %20 Percent Sign / Space Causing Problems with PHP
Probably Feed on Feeds read directly from $_GET, so you need to refine its value.
Try this:
Try this:
Code: Select all
if(isset($_GET['what'])) $_GET['what']= str_replace('%20',' ',$_GET['what']);Re: %20 Percent Sign / Space Causing Problems with PHP
I set up the echos, and it has the correct spaces with and without urldecode().
So it probably isn't the %20 that is actually causing the problem, but some other area where the spaces are screwing things up.
So it probably isn't the %20 that is actually causing the problem, but some other area where the spaces are screwing things up.