Jump to content

Archived

This topic is now archived and is closed to further replies.

mmosel

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

Recommended Posts

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...

Share this post


Link to post
Share on other sites
That's because it's a HTML entity. You should use:

?page=this&sub=that

Share this post


Link to post
Share on other sites
[!--quoteo(post=382085:date=Jun 9 2006, 05:40 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 05:40 PM) [snapback]382085[/snapback][/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.

Share this post


Link to post
Share on other sites
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']);

Share this post


Link to post
Share on other sites
[!--quoteo(post=382092:date=Jun 9 2006, 06:08 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 06:08 PM) [snapback]382092[/snapback][/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...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.