Jump to content


Photo

Help - I've got a prob using &sub in my url


  • Please log in to reply
4 replies to this topic

#1 mmosel

mmosel
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts

Posted 09 June 2006 - 10:06 PM

I've written my site using &sub in my url for getting to certain sub-pages. The only problem is that when I use the php variable $_SERVER["REQUEST_URI"] I get back a math character '⊂' . Strange. Technically, that should equal ⊂ but my url doesn' have the semicolon. I thought I could just replace the ⊂ with &sub in my script and it would work, but my editing tools don't recognize the character!

Worst case scenario is that I'm going to have to rewrite my whole site to use a different variable for the sub-page. That is unless someone here has a bright idea!

Word to the wise - don't use &sub as a variable in your script for URLs.

(as in ?page=this&sub=that)

There's alot more to avoid too...

[a href=\"http://en.wikipedia.org/wiki/Help:Filling_the_page\" target=\"_blank\"]http://en.wikipedia.org/wiki/Help:Filling_the_page[/a]

See the bottom of this page for more...

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 09 June 2006 - 10:40 PM

That's because it's a HTML entity. You should use:

?page=this&sub=that
~ D Kuang

#3 mmosel

mmosel
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts

Posted 09 June 2006 - 10:44 PM

[!--quoteo(post=382085:date=Jun 9 2006, 05:40 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 05:40 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
That's because it's a HTML entity. You should use:

?page=this&sub=that
[/quote]

That's for HTML output, not URLs I believe. URL encoding is different.

I actually tried that, but my script didn't recognize that.

& should be correct for PHP and it does normally work.

#4 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 09 June 2006 - 11:08 PM

OK, then that's just the "HTML illusion".

Actually PHP understands that it is &sub and not the math symbol, but once it's printed the browser thinks it's the entity.

Internally there should be no issue, but if you want it to be displayed correctly, use htmlentities($_SERVER['REQUEST_URI']);
~ D Kuang

#5 mmosel

mmosel
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts

Posted 10 June 2006 - 12:04 AM

[!--quoteo(post=382092:date=Jun 9 2006, 06:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 06:08 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
OK, then that's just the "HTML illusion".

Actually PHP understands that it is &sub and not the math symbol, but once it's printed the browser thinks it's the entity.

Internally there should be no issue, but if you want it to be displayed correctly, use htmlentities($_SERVER['REQUEST_URI']);
[/quote]

Ah, maybe that would have worked. I actually just finished combing through my scripts and updating the &sub variable to something else, and now the REQUEST_URI works like I thought it would.

Thanks for your tips...





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users