You are here: Re: urlencode and $_GET « PHP Programming Language « IT news, forums, messages
Re: urlencode and $_GET

Posted by meltedown on 11/17/05 18:42

Erwin Moller wrote:
>
> I do not see the problem to be honest.
> I just tested on my own machine (PHP5) the follwing:
>
> http://bla.bla.bla/test.php?id=HJUYH_%234_NAT
>
> from php.test:
>
> $id = $_GET["id"];
> // ID now contains HJUYH_#4_NAT
>
> Which is excactly what is expected.
>
> So show us some more code.
>
> Regards,
> Erwin Moller
>
>
Right, I believe you. I know what it is now. Its not a PHP problem, its
a mod rewrite problem. Sorry, I left it out because I was trying not to
complicate my explaination.

if I use
http://thecigar-auction.com/item.php?id=SANROSA_%234_NAT
it works fine.

but if I use:
http://thecigar-auction.com/santa-rosa-no-4-natural/SANROSA_%234_NAT.html
The last part gets tuncated into SANROSA_

Here's the rewrite rule :
RewriteRule ([^/]+)/([^/]+)\.html$ /item.php?id=$2&cname=$1

The second ([^/])+ is the culprit, but I'm not sure how to fix it.
Presumably, it doesn't recognize %

Right now I have fixed the problem with a hack
$id=preg_replace("|#|",'_PDSGN_',$id);
So this example now looks like:
http://thecigar-auction.com/santa-rosa-no-4-natural/SANROSA__PDSGN_4_NAT.html

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация